How do I deleting inventory slots?

0 favourites
  • 5 posts
From the Asset Store
Inventory Aid
$4.90 USD
Create grid-based game inventories and items easily.
  • Hi everyone,

    When I added the option to change the location of the hero, there was a problem with the inventory.

    When the player changes the layout, slots are deleted and recreated, thus losing their properties, such as whether the slot is full.

    I have inventories created on a separate layout, and in each location I add them as a layer.

    Any idea how to prevent destroying my InvSlots :)?

  • You can set these sprites as Global, but make sure that there is only one copy of them on the first layout. Then they will be transferred to another layout automatically with all their instance variables.

    If you place global objects on a global layer, this may result in duplicate instances. So be very careful and check them in Debug View.

    Another solution is to store the inventory in an array or JSON, and just re-create it every time you are switching to another layout.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I make them global but when i change Layout they duplicate.

    You mean for example put global inv sprites on they screen (make them invisible)??

  • I make them global but when i change Layout they duplicate.

    That's what I was talking about. You need to create them only once at the start of the game. Don't put them on a global layer in the editor, because then their duplicate will be created every time you switch to a layout with such layer.

    I don't like using global objects for this reason. I suggest instead re-building the inventory on start of every layout from data stored in an array.

  • Ok solution with creating INV_Slots on one starting layout and make them global work.

    Thanks dop2000 :)!

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