Question about placement of objects

1 favourites
  • 7 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hello, could you please help me resolve one issue?

    There are three free places with numbers 1,2,3. I would like to make it so that when I click on an object A or B or C, it moves to free place 1. But if this place is occupied, it moves to place 2, if it is occupied, then go to place 3. Could you please help me, how can this be done?

  • Add an instance variable IsOccupied to the placeholder sprite.

    When object A/B/C clicked, pick the first placeholder sprite with IsOccupied=0. Move the object to it and set its IsOccupied to 1.

  • Add an instance variable IsOccupied to the placeholder sprite.

    When object A/B/C clicked, pick the first placeholder sprite with IsOccupied=0. Move the object to it and set its IsOccupied to 1.

    Thank you very much for your answer. Unfortunately, I still can't resolve this issue. I don't know what to do with the other places 2 and 3. One object moves to position 1. Other objects do not move to positions 2 or 3.

  • I tried again, now the object is in position 3 instead of 1. I'm definitely doing something wrong

  • I hope your objects A, B and C are actually 3 instances (copies) of the same sprite?

    Anyway, you need to post your code or project file.

  • I hope your objects A, B and C are actually 3 instances (copies) of the same sprite?

    Anyway, you need to post your code or project file.

    Thank you very much for your help, everything worked out for me. I'm trying to make inventory for my game this way. I have one more question. Is there any way to sort objects A B C that are already in places 1 2 3. I would like to make it so that if one of the objects disappears from its place, the rest are sorted and take the missing place. Could you please help me, is there any way to do this?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Everything is possible of course. You can pick all objects in the inventory, loop through inventory slots moving each object to a new slot.

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