A
Andrea N
Guest
Hi all,
I have one object enemy and more object player (multiplayer game).
Obj_enemy have to follow the nearest player, but only if a variable of obj_player is true. For example inside obj_player variable "follow_me"= true or false.
Now i have to check from obj_enemy step event:
If instance_exists(obj_player){
If (obj_player.follow_me == true){
player_to_follow=instance_nearest(x,y,obj_player);
move_towards_point(player_to_follow.x,player_to_follow.y,speed);}
Else{player_to_follow=0;
Obj_enemy.speed=0;}
}else{player_to_follow=0;
Obj_enemy.speed=0;}
When obj_enemy is following obj_player, and i change the obj_player.follow_me variable, obj_enemy stops to follow obj_player, and it's ok! But if obj_player are more than one, i need to follow the other obj_player.follow_me = true; !
How can i find the instance_nearest(x,y,obj_player.follow_me==true)???
I hope i explained myself, thanks
I have one object enemy and more object player (multiplayer game).
Obj_enemy have to follow the nearest player, but only if a variable of obj_player is true. For example inside obj_player variable "follow_me"= true or false.
Now i have to check from obj_enemy step event:
If instance_exists(obj_player){
If (obj_player.follow_me == true){
player_to_follow=instance_nearest(x,y,obj_player);
move_towards_point(player_to_follow.x,player_to_follow.y,speed);}
Else{player_to_follow=0;
Obj_enemy.speed=0;}
}else{player_to_follow=0;
Obj_enemy.speed=0;}
When obj_enemy is following obj_player, and i change the obj_player.follow_me variable, obj_enemy stops to follow obj_player, and it's ok! But if obj_player are more than one, i need to follow the other obj_player.follow_me = true; !
How can i find the instance_nearest(x,y,obj_player.follow_me==true)???
I hope i explained myself, thanks