How do I track the same sprite in the scope context?

0 favourites
  • 2 posts
From the Asset Store
Minimal Sprite Font with Stroke for Pixel Art games.
  • Hi, I have been tormenting this solution for two days already .. The situation is like this:

    we have several inventory slots with one sprite and items that are important to move as UID objects, and not just change the animation. The array does not play a special role here, data is only written to it. The root of the problem is that if you move an item onto an item, they will swap, but the ui_bottom_button.AY variable for the starting slot will not change. I'm struggling with a solution, and at the moment I'm at the stage with a function that made things even worse.

    My logic for moving an item:

    1) When you start dragging, the starting cell becomes AY = 0, that is, empty.

    2) If you drop an object into an empty cell, then it will become AY = 1, that is, full, and the starting cell will remain AY = 0. (IT WORKS)

    3) If you swap items, then the item being moved is installed in a new cell, the cell becomes AY = 1, and the other item flies to the starting cell. Its AY becomes 1, since the cell is full again.

    And at the last stage, problems occur that I cannot solve. The starting slot cannot be tracked, since any actions with it, even through Selection via UID, through cycles, through variables, do not work, since the system tries to access the already selected slot in this chain, that is, to a new one. I just can't figure out how I can get out of this pit and force Construct to change the local variable of the cell, which I need to refer to exactly within the chain, in which another cell is already selected.

    I hope I have explained it clearly, I will be glad to any advice.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The only clumsy solution I see is to check every tick if the item overlaps the cell and manually assign AY = 1 to it. The only question is how this will affect performance, since this is clearly done in a loop.

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