Ask here your questions to get help using GDevelop.
By Umar
#68068 My entire game have topdownmovement behavior. Now what happens is the a lot of my enemies take the same position. How would I make them take different position, when they are standing on the exact same place? Please help I beg you!
User avatar
By Lizard-13
#68069 Use the action to separate objects "Separate Enemy from Enemy", I think it works no matter if you put the same objec name in both paramenters. Now take into account that the separate action checks collisions, it may be slow if you have... say... 300+ enemies :)
By Umar
#68072 Well collision is not the solution of the problem... I mean this operation separation will only make these object look like they are colliding with each other and the cars will still try to go in the same direction. so it will get stuck. What I want rather is my enemies to b a bit smarter and realize when they are on the same position (I can check if they are colliding) and then one of them should just change their position slightly. Also FYI they have some logic, That I have define for them to move, using variable "UpDown" and "RightLeft".
User avatar
By ddabrahim
#68073
the cars will still try to go in the same direction

In case you are moving them to position, the problem might be that they did not reached their position so they keep trying and the two event to move object to position and separate two object are in conflict because the object trying to move to position but the separate two object prevent it and so it keep trying. So what you might want to do is set a new target position until find one that can be reached and as Lizard-13 suggested use the separate two object event to make sure the cars don't run over each other in the process or accidentality stop on top of each other. You can also use pathfinding to make them a bit smarter to find destination. Pathfinding allow you to easily check if a destination can be reached or not, if not, pick an other (random) position within a radius or something.
By Umar
#68079 Below is the picture with all the logics that I have used for the controls and AI. Now the birthplace variable is for the cars to know that which side they are born on (like Top,Bottom,Left or Right). Position is The variable for them to know which side they are at so that they know which angle or side they have to attack. Now if you want to ask anything you can ask but how would I separate them?
Attachments
Untitled 3.png
Untitled 3.png (163.57 KiB) Viewed 77 times