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.
For each enemy
system compare two values : distance(enemy.x,enemy.y,player.x,enemy.y) < 100
Develop games in your browser. Powerful, performant & highly capable.
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.
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
no you write in the first one:
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