How Hard Would an Inventory Like This Be?

Get help using Construct 2

Post » Sun Jun 16, 2013 9:57 am



Im trying to wrap my head around arrays,It seems everyone is having issues with them these days.I wanted to know how difficult it would be to create a simple inventory like this one,I just want to be able to drag it from the bottom of the screen.The Game im showing is called Growtopia and its free on android if you want to check it out.I really need some help with an inventory without one my project is ruined.Thanks EveryoneRookieDev2013-06-16 10:01:16
GMO FOOD = DEATH
B
23
S
9
G
5
Posts: 567
Reputation: 6,378

Post » Sun Jun 16, 2013 12:16 pm

You could always use two array lists:

Inventory_Slot (How many objects of a given type is within this slot?)

Inventory_Type (What kind of object does this slot hold at the moment?)

When you add an object to the inventory in-game, use a loop to go through Inventory_Type from zero to 19 or whatever. Here's some pseudo-code:

(where x is the current value being looped through)
If Inventory_Type(x) = Object.Type OR Inventory_Type(x) = 0 (as in empty) --->

Inventory_Slot(x) = Inventory_Slot(x) + 1
Inventory_Type(x) = Object.Type (if the slot was empty we need to set it to the type of object added).
B
39
S
16
G
6
Posts: 542
Reputation: 7,617

Post » Sun Jun 16, 2013 12:31 pm

@ErekT Thats basicly what i want is two simple lists,I just dont know how to make it happen the way you see in the picture.I want to have a real simple inventory and the way you are explaining im starting to get it somewhat,Most of the tutorials show how to make random arrays and generators,The inventory tutorials are way too advanced for a new person.If you could show me a better way to look at it i would be grateful,I know i can learn its all about having the right person explain it.Everyone learns Differently at different speeds but thanks man your words of wisdom will help me alot.
GMO FOOD = DEATH
B
23
S
9
G
5
Posts: 567
Reputation: 6,378

Post » Sun Jun 16, 2013 4:11 pm

Don't know about the wisdom part but happy if I can be of help. Only had time to write up some pseudo-code real quick but I'll see if I can explain it a little better tomorrow. ErekT2013-06-16 16:14:32
B
39
S
16
G
6
Posts: 542
Reputation: 7,617

Post » Sun Jun 16, 2013 4:16 pm

I recently wrote a tutorial on how to create a simple inventory system. It looks like what you want is the same as what I wrote but if it's different I'd be glad to alter it for you.

Edit: Here's the linkEncryptedCow2013-06-16 16:19:09
B
46
S
14
G
7
Posts: 603
Reputation: 8,106

Post » Sun Jun 16, 2013 4:19 pm

Once you have a solid knowledge about arrays, something like this shouldn't be too hard.
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,679

Post » Sun Jun 16, 2013 7:52 pm

@sqiddster @EncryptedCow @ErekT Thank you guys for helping me it does mean alot,I apollogize for the late reply I stayed up all night working on my project.I will take a look around At your tut EncryptedCow,I know its just me and not you guys,I am a slow learner everyone of you explain really well its all about how i absorb this knowledge im being fed.I hope i can get this down i really do need a dragable type of [email protected] If you can show me how to create a box that i can drag up and down the screen To hide/Unhide it like the pic that would be epic.But other than that im just going to try and study Cows tutorial.Thank you Guys This means alot
GMO FOOD = DEATH
B
23
S
9
G
5
Posts: 567
Reputation: 6,378


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 25 guests