Users browsing this thread: 1 Guest(s)
What's the Most Efficient Way to Program This?
#12
(08-09-2013, 09:17 AM)Koh Wrote: the second represents specifics:

Second Value Meanings

Hmmm, you can approach it from another and clearer way. Going this route of "an index represents a property value" is very complicated and not very intuitive.

Since It seems you can't create classes without inheriting all the GM Object garage, I'd go with the approach of just creating multiple arrays that define a single property foreach inventory slot item.

Example:

Code:
int maxInventory = 32;

boolean[] slotOccupied = new boolean[maxInventory];
int[] Class = new int[maxInventory];
int[] ID = new int[maxInventory];
int[] SpecialQualityID = new int[maxInventory];
string[] Name = new string[maxInventory];
...
...
int[] EnergyModifier = new int[maxInventory];
Image[] SpriteIcon= new Image[maxInventory];

How you would access a property:
Code:
global.EnergyModifier[25] = 0;

It's obvious which inventory slot you're talking about and what property you're changing.
Animations - MFGG TKO (scrapped) - tFR
[Image: QUmE6.gif]
"It feels that time is better spent on original creations" - Konjak
Focus on the performance, the idea, not the technical bits or details - Milt Kahl
Thanked by:


Messages In This Thread
RE: What's the Most Efficient Way to Program This? - by TheShyGuy - 08-09-2013, 02:52 PM

Forum Jump: