Hi together,
I want to let my enemies move to the player after they have been created. It's a very simple game. I have a player who is able to move left and right and to jump. The game spawn several enemies on the screen. Now the should "attack" the player and move to his position (player.X, ground.Y). And if the in a specified range the should do a action (like shoot or something like that).
But i'm not quite sure how to set this up. Has anyone an idea?
Develop games in your browser. Powerful, performant & highly capable.
If enemies.x < player.x , enemies.x=enemies.x+1 else enemies.x=enemies.x-1
if distance(enemies.x,enemies.y,players.x,players,y) < whatever then action whatever .
Hi
Thanks a lot for your fast respone. I tried to set this up, but the enemie doesn't move.
Is that right?
Edit: forget it, found my problem
Hi again,
I tried to set up this with the distance, but I'm not sure which event i should use. Can you set it up and send me a screenshot like i did above? Just the distance event
Thanks a lot!
AndreasR or you could use Bullets behavior and set angle toward position and use player as your position
Hi Lordshiva1948,
Thanks for your reply. I already have set it up like grandpa said But do you know how to let the enemy do an action if a certain distance between enemy and player has been reached?