Does someone have a inventory engine for me (i searched but all i found were dead links), it would be great if the engine was not only limited to 32 directions but that it could also handle multiple animations. And it would be insane if it als had stacking. I hope someone can help me, I don't want to get stuck with my game again
Easily done with a 3D array
Example you have
Apple (item id 1) x 25
Arrow (item id 2) x 300
Shortbow (item id 3) x 1
(0,0,0) would be 1
(0,0,1) would be 25
(0,1,0) = 2
(0,1,1) = 300
(0,2,0) = 3
(0,2,1) = 1
This means that at position (0,0) of the first 'depth' would be the apple, increasing the 'depth' location would be the item quantity
You could combine this method with a List object containing all item names (item ID may correspond to line 0, depending on how TGF/MMF/MMF2 calculates it)
Obviously when it comes to having your objects display, check to see if the positions are empty in the item ID sections, and if they are dont display anything, otherwise display the correct object in that position.
If you want more than 32 directions (one for each object) you can have different frames of one direction for an object (just simply force the animation to that frame, and dont play the animation)
What kind of inventory are you looking for? I have an old example of mine for how to do a Diablo style inventory, down to the picking up/dropping items and prefixes/suffixes, as well as a more minimalistic version of it I'm using for Gridquest.
Yeah we really do need to know what kind, for example for my inventories I store them as 1D arrays: 0,1,2,3,4,5, etc. (Note I have not yet found a good way to get item counts with this system but in my current games that doesnt matter as more than one of something is unneeded)
I should use a 2D array and the Jam's string tokeniser object so I can have: ID.number,ID.number etc... Might do that now actually!
(I use strings because I like to pack my inventory into the same save file as all other data.)
If your items animations work as "Always: Set item animation direction to (Item Value A)", you will only be able to store 32 different directions in each animation. Thus, Item #32 would look exactly the same as item #0, causing you some grief.
Instead, simply put in code along the lines of:
"If Item Value A => 0"
+"If Item Value A < 32"
="Set Item Animation to (Stopped)"
and then write:
"If Item Value A => 32"
+"If Item Value A < 64"
="Set Item Animation to (Walking)"
You can then store your new items in the 32 directions of the "Walking" animation, too. In Gridquest, I have the same setup with my monsters; every single monster sprite is stored in a single active object, and I use up all 32 directions of every single animation available in TGF.