The Daily Click ::. Forums ::. Klik Coding Help ::. Inventory option at Base
 

Post Reply  Post Oekaki 
 

Posted By Message

Catnip Bravo



Registered
  23/01/2014 00:09:35
Points
  1
23rd January, 2014 at 23/01/2014 00:19:47 -

Hello Everyone. First post. I have been searching the boards and YouTube for a tutorial that might answer the following question, with no success. If anyone has a link to point me to, that might help or someone else has done this please let me know.

Info: The game layout is a sidescroller with a base for player 1 and a base for player 2. I want to have it so if player 1 or player 2 goes back to their base they can press a button and pull up an inventory of items. All items available will be listed, but the player cannot buy said items unless they have enough currency. So what I need are guides on.
1. Inventory. (How do I pull up an inventory box?)
2. Currency. How do I tie currency to the items in inventory?

Any help would be appreciated. I apologize if this has been discussed else where. If that is the case just respond with a link.

 
Yip, Yip, Yippee!

Pan-tosser



Registered
  24/10/2008
Points
  520

Has Donated, Thank You!
23rd January, 2014 at 23/01/2014 15:41:31 -

I don't know why their aren't any tutorials out their. Inventory is a pretty standard thing. Their is an inventory extension object out their. I found it by using the click team program extensionview.

You can get that program here http://softadvice.informer.com/Extension_View_2.15_Mmf2.html

It might be a good place to start for you. But the object is more of a Data structure for your inventory. Creating graphics that have values that the Data structure can test for isn't automatically created.

So you would still have to create a couple blocks of custom code to talk to your inventory object. You can do it though.


 
https://www.facebook.com/nathon.brown.7

Jenswa

Possibly Insane

Registered
  26/08/2002
Points
  2723
28th January, 2014 at 28/01/2014 20:57:36 -

A little search showed some tuts, like this "Slot Inventory System" one:
http://www.create-games.com/article.asp?id=1332

But you probably want to tie the data together in some kind of data structure with a reference to the graphic, the cost and other values the item might need to hold.

As example I would program a 3x3 grid with items numbered 0 til 8. Item zero might cost 200 in game currency points or something like that, store it for instance in an INI object. Do the same for the other items.

Display the items together in a 3x3 grid when the inventory box should come up and hide them when done.

This is just a general idea, the specific implementation of this is up to you. Perhaps try starting out small with a 2x2 grid fro testing and if it works expand it to your liking.

Cheers,
Jenswa


 
Image jenswa.neocities.org

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
30th January, 2014 at 30/01/2014 15:51:32 -

I'd use an array to hold the info about items (including cost), and a global value to keep track of the player's funds. Then when it comes to buying an item, you just compare the two, and if the player has enough money, you deduct the cost and give the player the item. That part is extremely simple.

When it comes to actually handling items in the player's possession, there are a million ways to go about that, so you'd need to be extremely specific about what you want.

eg.
Maybe you want to increase a counter (eg. a clip adds 20 to "ammo").
Maybe you want to replace the player's weapon (eg. the player loses his pistol, but gets a rifle instead).
Maybe you want item slots / squares (eg. a backpack holds up to 10 items).
Maybe you want a weight limit (eg. a rifle weighs 10kg, and the player can carry up to 20kg total).
Maybe you want some items to take up multiple slots / squares (eg. a grenade uses 1 slot; a rifle uses 3 slots).
Maybe you want some items to only go in certain slots / squares (eg. a helmet can only be worn on the head).

The possibilities are endless...

 
n/a
   

Post Reply



 



Advertisement

Worth A Click