Hundreds of features to explore
Games made in Construct
Your questions answered
Trusted by schools and universities worldwide
Free education resources to use in the classroom
Students do not need accounts with us
What we believe
We are in this together
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
Could someone help me out, by telling me how to make an Enemy shoot only if the player is at, lets say x distance away from it? [Platformer Game]
Please if possible if you could make an attached file for it.
Thank you,
kind regards,
Rafael0125
For each enemy
system compare two values : distance(enemy.x,enemy.y,player.x,enemy.y) < 100
for the secound one is it
distance(enemy.x,enemy.y,player.x,player.y or enemy.y??
thanks for the reply... will just try it out
I used enemy.y because I thought you only wanted the horizontal distance (x)
If you use player.y it will be like a circle arond the enemy.
Develop games in your browser. Powerful, performant & highly capable.
ok ... so when I went to system ccompare two values .... it asks for the first one than compare than secound value...
So for the first one I write: enemy.xenemy.y
less or equal
for the second one I write: player.x,enemy.y
yup for horizontal
thanks :)
no you write in the first one:
distance(enemy.x,enemy.y,player.x,enemy.y)
and in the second one the number of pixels distance you'd like.
Thank you very much ... sorry for acting like a noob ... I am bad at programming :( trying my best to learn