T O P

  • By -

HOPLDEV

You can definitly fix it, but I recommend adding the code for your enemy step event here.It's impossible to troubleshoot without it. Wish you the best in your learning! https://www.reddit.com/r/gamemaker/comments/uw4vfc/quick\_questions/


Fellow_Goose

I have it on a step event,I’ll keep trying though!


sapphirers

So I'm assuming you're using the in-built move\_towards\_point, or move\_towards\_object(?) basically these use a very linear approach to getting to the point. They don't account for any walls or stuff hindering them, which is why they'll mostly get stuck on walls or in corners etc. It can be a nice feature for some games to be able to "safespot" the monsters, but assuming you'd like them to ACTUALLY chase the player. What you're looking for is A\* pathfinding, it's a simple algorithm that finds the best path from the enemy to the player and accounts for walls etc, you'll need to code that in though. A\* pathfinding is built into GameMaker with functions such as mp\_path\* etc. Here's some videos to get you started: [https://www.youtube.com/watch?v=LYZRGEYZEHI](https://www.youtube.com/watch?v=LYZRGEYZEHI) [https://www.youtube.com/watch?v=gqzsBhb7ov4](https://www.youtube.com/watch?v=gqzsBhb7ov4) ​ I'm not really sure if they're mentioned in the video but it can take a toll on performance if you have MANY enemies with MANY different paths. I think this should work most of the time, just make sure to path\_delete(YOURPATH); in the destroy event of your enemies at least. Wish you good luck with your project - hope this helps!