How do I do a multisized item inventory system like STALKER

0 favourites
  • 3 posts
From the Asset Store
Inventory Aid
$4.90 USD
Create grid-based game inventories and items easily.
  • I'm looking to create an inventory system similar to STALKER where different items take up different space shapes.

    You see the bags there take up rectangles and smaller items take up one or two spaces.

    What is the simplest way to achieve this in Construct? Should I use arrays and for loops so the system checks if said item is taking up specified array spaces?

    thank you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can do it with array and loops, but I think it would be much easier to use "Is overlapping" event.

    Make item's collision polygon a bit smaller than the slot, or several slots for big items. Create an instance variable isOccupied on slot sprite.

    When player is dragging and dropping the item to the inventory, test if it's overlapping an empty inventory slot, and not overlapping occupied slots or the border around the inventory area.

    When the inventory layer is hidden and player picks up an item off the ground, you can pick all empty slots, do "For each slot", set item position to each slot, test if it's overlapping occupied slots/border. Repeat the loop until you find a suitable slot(s).

  • dop2000 yeah I did it this way. Was curious to get into shaped arrays for another idea of a game I had that I'm going to do int he future So I considered this killing two velociraptors with one stone.

    thank you!

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