I am having a slight issue. I have code that tests for two objects distance, Enemy and Player. If Enemy is within the distance of the Player to be able to attack I have the code set to Every X Seconds, X being the Enemies Agility Variable, call upon the attack function. The problem is this only works for which ever enemy my player walks into range of first. If I am surrounded by more then 1 enemy their Every X Second commands do not work until the first is destroyed. As this would be ok in a turn based game, I need help making it so it will run it independently, so I can be in range of various Enemy objects with different times and have it all work together.
The code I have right now is
distance(enemy.x,enemy.y,player.x,player.y) <= 800
-- Every Enemy.AGILITY seconds:: Call Attack Function
Thanks in advance guys!
(Side Note. I have tried the For Each condition hoping that would work, however it did not... Perhaps I am using it wrong?)