Inventory item disappears when switch from one layout to another

0 favourites
  • 9 posts
From the Asset Store
Inventory Aid
$4.90 USD
Create grid-based game inventories and items easily.
  • I have a global layout that serves as my GUI. Array and variables are of global type. There is an inventory of three places that is filled when an item is picked up. It works in such a way that it switches to the appropriate frame of the animation on which a certain item is displayed. When I switch to another layout, the item picked up in the previous layout disappears in those places. The function and array work fine. If I set these item slots to be global, then I get a copy of those slots at the beginning of the screen, which do not move with the camera, but are filled with right items.

    I tried to put behavior persist on the item slots, I tried to use the pin for the main element of the GUI, but nothing helps. The slot is filled when an item is picked up. Would at the beginning of each layout somehow have to say that all the items picked up in the previous layout are reloaded into the slots in the new layout. I've been struggling with this for quite some time now.

  • Yes you should set on start of layout so slot 1 = array.at(1) or whatever logic you used.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is function that is used.

    And this is part when you pick up an item.

    Now I'm interested in how to read the values in the array and then display them in the same order in the slots in the simplest way without without unnecessary complications.

  • If I put on those slots that they are global, then they remember all the items that were in them and that seems to me to be the best solution, the only problem is that it will not scroll together with the camera anymore, as if the parallax it uses is canceled.

  • I solved the problem in the most primitive way. Later I will study the possibilities and write it more nicely.

  • If the parallax is cancelled as you described it, means the inventory items are on the wrong layer or that the layer does not have the same parallax as in the other layout i.e. it's not the same global layer.

  • I solved the problem in the most primitive way. Later I will study the possibilities and write it more nicely.

    Yes exactly, this is what I wrote above as an example

  • Parallax for GUI is 0,0 and scale rate also 0. All items that GUI uses are on that layout.

    There is same UI layer in other layouts where it is overridden with Global. If I put global on inventory slots then When I'm switching from one to another layout it doubles the inventory interface. One that is moving with the camera which is empty and another that is full with items picked on previous layout but on the wrong position and not moving with camera.

  • You don't make both the object and the layer global, one or the other. If the slots are in a global layer you don't need to then make them global.

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