[WIP] Drag & Drop Inventory System

0 favourites
  • 3 posts
From the Asset Store
Use inertion of your movements to throw, rotate your objects and etc. Objects can interact with others while dragging.g
  • Hello,

    I was out for at least some months, busy with an incredible amount of work, but now I can return to my preferred hobby <img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing">

    Let's talk about this Drag & Drop Inventory System. This inventory system is made without the use of arrays and families or functions, but need some improvements to reduce the amount of events.

    I'm planning to make another version with the use of families, reducing significantly the number of events by the simple fact of complexity while dealing with items of the same type overlapping each other.

    It's needing some improvements on the items dropped on the canvas, but at least it's working fine in the bag and equipment area <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

    You can play the actual demo here on Arcade: https://www.scirra.com/arcade/tutorial- ... 0808-13249

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just curious as to why you wanted to avoid arrays?

    If i were creating this sort of system i would definitely use

    an array and maybe a dictionary.

  • Hi BACLog, I first did with, but the actual sample was made as it is just for the challenge =]

    I noticed the whole inventory is an array of objects, for a fixed quantity it's not necessary to setup an array, but if you do a dynamic inventory, where the slots increase it's size, so, the array is most than necessary.

    The whole eventsheet will be changed again, to compact it to 20 events or near or it (plus the debug on screen events) and maybe an array become necessary.

    The first time I used arrays I noticed:

    For this type of inventory, where you drag an item over another and they swap, you need to know the origin and the destination.

    The destination is important when you're over the equipment slots, so, you need to check what type of equipment is being dropped;

    The origin is important when you're dragging an item from the equipment slot to the inventory;

    Knowing this, arrays was not useful because any check to manipulate it can be reached by directly manipulating the objects involved in the movement.

    Next step is implement new behaviors, like to find the first slot available when you drag an item from the equipment slot to the inventory, and it can be done by checking an array or checking the first slot in the inventory not overlapping an item (what the array also need to know, to manipulate itself).

    Here is the problem, any additional check to manipulate the array can be used without the array and directly to the logic by setting instances variables or simple global variables, making the events simple.

    But, later I'll be implementing quantity for consumables and others items, there I can use an instance variable directly to the item or an array.


    Updated. Now it's free of bugs, also, I changed some layout elements and implemented a cute slime to be slashed by our finger

    I'll be updating the Arcade soon, hope you like!


    Arcade Updates

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