[Solved] What is the logic for making enemies chase you?

Hey folks,
I’m trying to write a turn based, grid based game similar to Mummy Maze of 2002

I’m thinking hard but can’t figure out how can I make the mummy chase me?

You can see this video around 11 min.

That’s an interesting challenge. The pathfinder behavior would help in some instances especially the “linked objects tools” version bc it’s Grid based. I don’t know how to limit steps per move. I’m pretty sure it has a built-in method.

I also like the idea of tweening from the center of one tile to the next using either ray cast or point is inside. That would work well for the player. I’m not sure about the mummy. It would probably be a mix. The pathfinder would definitely help finding a path even if you use a difference method.

Edit: you wouldn’t actually need tiles if you moved in a grid using Tween from current position to x() +gridSize or Y() + gridSize. Although, the "linked objects tools” needs a grid of tiles to work. The background could be a tiled sprite while the tiles could be hidden.

1 Like

Thanks @Keith_1357
This makes sense. I’ll try out what’s you said and keep you posted on this thread.

1 Like

You’re welcome. I might try it myself just to see if I can. I see GDevelop more as a puzzle game. I enjoy trying to build things. They don’t really go much farther but the challenge is fun.

2 Likes

Thanks @Keith_1357
Your solution worked.

Here’s how it was executed:

  1. My game uses 16 px sprites, and I used Pixel Perfect Top Down movement behaviour to bind sprites to grid

  2. I used Pathfinding tool as well.
    image

  3. On the next clock pulse of “wait”, the “Enemy” will move to my character “Bard4” using pathfinding

1 Like

You’re welcome. Good to hear.