The Daily Click ::. Forums ::. Klik Coding Help ::. Inventory (again)
 

Post Reply  Post Oekaki 
 

Posted By Message

Aptennap



Registered
  23/04/2004
Points
  916
24th February, 2008 at 16:13:31 -

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

 
Oh sweet mary.

Xhunterko



Registered
  07/05/2003
Points
  1015

VIP MemberHas Donated, Thank You!Hasslevania 2!Pokemon Ball!
24th February, 2008 at 16:59:06 -

I think there might be an example in the fast loop object documentation. It should be fairly simple and easy to get.

 
All platforming problems can be mostly solved here:

http://www.clickteam.com/mbfiles2/277308-engine.zip
http://www.angelfire.com/games5/psywakd/platform.gam
www.zephni.com

These are very excellent examples by other people and are very informative.
Image

I work at the speed of "maybe".

Coming Soon: Diary Of An Indie Developer
http://www.youtube.com/watch?v=XaF6H9MrgH8

Twitter:
http://twitter.com/xhunterko

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
24th February, 2008 at 17:47:39 -

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)



 
My signature is never too big!!!

Aptennap



Registered
  23/04/2004
Points
  916
25th February, 2008 at 05:25:51 -

Oke thanks gonna try making it.

 
Oh sweet mary.

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
25th February, 2008 at 21:28:15 -

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.

Image Edited by the Author.

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

viva/volt

Awesome Sauce

Registered
  26/08/2006
Points
  1694

Game of the Week WinnerSilverNova MemberKlikCast StarVIP Member
26th February, 2008 at 00:33:18 -

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.)

 
Image
http://bfollington.tumblr.com

Aptennap



Registered
  23/04/2004
Points
  916
26th February, 2008 at 04:45:37 -

The best would be an inventory that supports picking up stuff, dropping stuff, stacking and more than 32 items. But I can live without the stacking part.

 
Oh sweet mary.

viva/volt

Awesome Sauce

Registered
  26/08/2006
Points
  1694

Game of the Week WinnerSilverNova MemberKlikCast StarVIP Member
26th February, 2008 at 06:24:23 -

I found an old example by radix that covers just about all of that . It has stacking (drop the same item on to another of it's kind) picking up and dropping etc. Very nice really.

http://www.silvernova.co.uk/examples/inventoryradix.zip

 
Image
http://bfollington.tumblr.com

Aptennap



Registered
  23/04/2004
Points
  916
26th February, 2008 at 10:52:31 -

Thanks, that was just what i needed!

 
Oh sweet mary.

Aptennap



Registered
  23/04/2004
Points
  916
26th February, 2008 at 11:38:56 -

Okay, the inventory is now in my game, I have a problem though:
-How do you add more items than 32, is it a new animation or a new frame (i tryed both, but none worked).


Image Edited by the Author.

 
Oh sweet mary.

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
26th February, 2008 at 14:30:46 -

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.

Image Edited by the Author.

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

Aptennap



Registered
  23/04/2004
Points
  916
26th February, 2008 at 15:39:24 -

Oke thanks, I'll try it in the morning

 
Oh sweet mary.
   

Post Reply



 



Advertisement

Worth A Click