I need enemy pathfinding help

So the monster if he sees the player he will start chasing after the player, But if the player gets too far the monster will go away. Or if the player is hiding like in a closet on something the monster would not spot the player. How do I do these type of things? Any examples?

you could use the code from the NPC objects in this game. you just have to change the code so they go towards the player instead of running away.

1 Like

Thanks! This could be good for a 2D game but I kinda need a top down one. Nice game though!

oh ok. in the future be sure to specify. you could look at the examples, im pretty sure there’s an enemy chase example for top-down

Yeah there is but it does not real help at all, but I think I can put something in the code to make it work as I want.

actually wait! i have a game where i made this. if the enemy goes out of view he begins to wander again
look for this object
image
in this game

2 Likes

Ok thank you! I will see if it works!

Is there a way for the monster to move without it rotating?

yes, here’s how you do it. You have to make another sprite of the monster. then attach the monster sprite to the object containing the hitbox and ai. then make sure not to enable match orientation, then the monster won’t rotate but it will still point towards the player

1 Like

Thanks, BradenS You are really smart! Thanks for the help :smiley:

also for your ‘hiding in a closet’
you could make it so when you go in the closet, send a message to the monster ai that goes into the “on” or “collision” input of the bundle
image

2 Likes

top down chase was done by @chrisdakiller here: Maze Hunt! (“Expansion” Expansion Pack) - Game Updates & Announcements - Flowlab Community

1 Like