Where to find enemy AI path finder / chase system example for Phaser 3?

Hi all! Where is there an enemy AI path finder / chase system example for Phaser 3?

I am building a Platformer.

Any help is as always, GREATLY appreciated! <3

Thanks! <3

You can see a example here: https://blog.ourcade.co/posts/2020/how-to-make-enemy-sprite-rotation-track-player-phaser-3/

Thank you very kindly, but I am looking for an enemy chase / path finder system. So the enemy basically chases the player through the level unless they get too close, in which case, the player gets hit. <3

Thank You! <3

But that’s for a top-down map. Pathfinding in a platformer would be more complicated because of gravity.

Simple chase is easy. Just have the enemies run left or right depending on where the player is.

@samme : What if I wanted the enemy to chase me up a ladder & off the edges of platforms unless the player gets far away enough from the enemy?

You can do pathfinding if you mark walkable and climbable tiles.

Basic chase is

var dx = player.x - enemy.x;

if (Math.abs(dx) < RANGE) {
	enemy.setVelocityX(Math.sign(dx) * SPEED);

Enemy will naturally fall off platforms unless blocked.

1 Like

Thank You, @samme & others! <3

1 Like