Page 1 of 1

Enemy moving when player at certain distance

PostPosted: Mon 19 Jun 2017, 13:49
by Navras
Hi all. I'm trying to move an enemy when player come to certain distance and move on after that.

I tried distance between two objects option. It is work when you come to the certain distance but enemy stops moving after they left the distance.

I tried used to Variables with "between two objects option". Ok the enemy keep moving when they left the distance but it effects every same enemy object even if they not at the distance.

Shorty this is what i want. For example. When player close to 300pxl to an enemy, it should move to the certain direction and keep moving after it left the distance.


It would be great if you know and explain how to do it.

Thank you so much.

Re: Enemy moving when player at certain distance

PostPosted: Mon 19 Jun 2017, 14:46
by Lizard-13
You could add an object variable to the enemy to let it know it has been activated. If the player is at certain distance activate the enemy and then, if the enemy is active, move it:
Code: Select allConditions: Distance between Enemy and Player is below 300
Actions: Do = 1 to the variable "active" of Enemy

Conditions: Variable "active" of Enemy is = 1
Actions: Move Enemy

Re: Enemy moving when player at certain distance

PostPosted: Mon 19 Jun 2017, 15:27
by Navras
@ Lizard-13
Thank you so much, it works. You saved my day :)