Position for many objects problem

In my game, there is a group of elements linked by clicking on any element in it that moves to a specific position, for example position A, then pressing on another element and it is in the same previous position, but so that it is above it, so that the elements that move to this position are all placed on top of each other, and I succeeded in this, but one of the strategies of the game is that you can click on it in the new position, so it moves to a new place, for example, position B. The problem is as follows: When you click on an item that has not yet moved to position A, and it is required to move to position A, it actually moves, but not Above the last existing element in position A. Pictures will make this clear

As you see< the third element went to the third box not to the second, Although the second became empty.
By the way, Awashee5 is a group of all elements.

You can use pick the nearest object in combination with collision conditions.

Try me. Click the circle. I used 2 groups. So, the discs can be moved twice.


The order of the conditions is extremely important because they use the result of 1 condition as the object of the next condition. The order in the collision event is also important. Some collisions are also inverted. You can use a single object for exact type or groups. I used multiple instances of the same object type.


Let’s walk through the 1st event

mouse released
Pick the green space that are not in collision with a disc.
(it’s important to check this before the cursor is on disc. Otherwise, it’s only checking the clicked on disc not all of the discs)
Pick the green space closest to the green checker
Pick the disc that the cursor is on.
Check if the picked disc is in collision with the start object

Then it moves the picked disc to the picked green space

I’m not saying this is the best way. Ultimately, it depends on the bigger picture.


sorry i cant help but you can help me :hamster:: How do i make so the character floats while in air but in a certain height but once if not in ground it falls down 2 - How do I…? - GDevelop Forum

Awesome, I think it is working well for me in my game, I well try it and comeback with results for you, THANK YOU A LOT.

I tried it and succeeded, I can’t find words to thank you, I spent 2 days to find a solution. :heart_eyes:

1 Like