How do I Equipment if i have inventory

Get help using Construct 2

Post » Wed Nov 19, 2014 4:02 pm

Message: kodisz can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
i have inventory, the same like in this tutorial https://www.scirra.com/tutorials/583/easy-inventory

if i can... eq slots for example weapon, helmet, armor

how can i do add lines: (equip item) and (unequip) through double clicked

i don't understand arrays and particular expression (array.curx)

:)) thx for reading
B
6
S
2
G
1
Posts: 32
Reputation: 589

Post » Wed Nov 19, 2014 5:28 pm

[url]i don't understand arrays and particular expression (array.curx)[/url]
Speed lesson about Arrays:
-Open new project
-Add Array
-Start debugger and click Array
-On Array data you will see the content. Vertical colums represent X dimension
-Edit Array to have 10 width and height
-Start debugger and click Array
-Now there are additional values representing Y dimension.
-If you add depth it gets a bit harder to read on the debugger but, the idea is the same.
-So you have basically a line, grid or cube of values
-Address for individual value in 3 dimensional cube X= -- Y=|| Z= // (0-based)

Array has its own loop function for each. So if you want to check all values on X you can use it. Note that this only works on 1 dimensional array. If you need to check at X and Y use for each XY.

For instance if you want to update your inventory item list you can run for each XY. Item images could have variables "slotX" and "slotY". Now during the loop you get for instance the right animation for that image comparing if current X and Y in the loop are the same as those variables on the Sprite object and change animation to value that is on that memory address.

There is multiple ways to set up equip system. You can have different inventory for equipped items or you just share the same one and there is value somewhere that which item from the inventory is been used.

I will highly encourage you to make it your self since there is no one right answer anyway and if you want to get anywhere on your project you should understand these basic principles first.
B
34
S
9
G
3
Posts: 517
Reputation: 5,276

Post » Thu Nov 20, 2014 3:03 pm

OMG !! you're god of arrays
i know !! all *.*
very thx for help
B
6
S
2
G
1
Posts: 32
Reputation: 589


Return to How do I....?

Who is online

Users browsing this forum: dop2000, max2612, Yahoo [Bot] and 5 guests