Pathfinding Move to a Position issue

I am creating a topdown single screen shooter (like Smash TV).

For homing “enemy sprites” towards my “player” 's one, I am using the “Pathfinding” behavior “Move to a Position” linked to my player sprite “Player.BoundingBoxCenterX()” and

It works, but after about two or three seconds and two or three changes of direction by the enemies, the enemy sprites no longer seek my object, and stops, one over another.

I have tried to link the behavior to “Player.X()” and “Player.Y()”: same thing.

I have seen there is an “Homing Projectile” extension, but I am not able to use it

My question:
it is normal that Pathfinder “Move to a Position” Behavior stops to refresh itself after about 3 seconds? There is a solution to this? Or should I have to use another behavior?

Thanks in advance for the replies

Can you share a snapshot of the movement events? It could be the frequency or triggering of the move events or if you’re using pathfinder obstacles, maybe the player isn’t reachable. A pic of the scene would also be helpful.

From top to bottom:
(1) Enemies "Mad_Chestnut"s appear to begin searching player “Nerina”.
(2) Enemies stop searching and finish one over another
(3) The branch of code relative to enemy creation and pathfinding towards player
(4) the Beahavior of the enemy “Mad_Chestnut”

I have also noted that before the enemy pathfinding stops, if my player goes on top or on bottom of the enemy sprites, they do not steer upwards or downwards: practically they steer only while moving to the left.


The at the beginning of the scene works like a trigger once but for the scene. It only triggers once per scene start. All of the events are processed from top to bottom. Even ones with the *at the beginning of the scene That only refers to the 1 frame not the 1st event.

If you want to keep the objects moving then you could use the reach the destination condition to move them again or use a timer to occasionally plan a new path.

If you don’t have obstacles, applying force toward the object might be more efficient. There are a lot of posts on the subject as well as templates/examples.

1 Like

now I am trying this:

and the pathfinding works, but the Gdevelop creates a nearly infinite number of continuous sprites:

I am not understanding clearly how “scene timers” and “object timers” conditions and actions works.
If i eliminate the “wait 5 seconds” i obtain a continuous moving line of pathfinding enemy sprites.

SOLVED! In this way, thanks to GDevelop Youtube Channel: Easy RNG That Has A Big Effect In Your Game - With GDevelop - YouTube

And here in my code branch:

Now, I MUST figure out how to stop spanning enemy chestnuts, but I will find a way :smiley: :smiley: :smiley:. (If someons has some ideas…)

If you want to create only one enemy create sub event under your 2nd event add trigger once to that sub event and to its action move create object action

IF you want to spawn more you can use event repeat X times

1 Like