Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Construct 3 runs in the browser & works offline
Students do not need accounts with us
Our educational partners
Free education resources to use in the classroom
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
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?
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 .
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
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!
Develop games in your browser. Powerful, performant & highly capable.
AndreasR or you could use Bullets behavior and set angle toward position and use player as your position
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?