0 Favourites

How do I Equipment if i have inventory

  • i have inventory, the same like in this tutorial

    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

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • i don't understand arrays and particular expression (array.curx)

    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.

  • OMG !! you're god of arrays

    i know !! all *.*

    very thx for help

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)