E
Emperor88
Guest
in my code i have a variable called action, this variable changes depending on what state/equipment the spaceship has, the main problem is that because the game has ships with repair tools, these ships will try to repair themselves forever. because the nearest friendly ship they can see is themselves. please help!
the code is as follows
if instance_exists(action) then
{
action = instance_nearest(x,y,action)
move_towards_point(action.x,action.y,Speed)
point_direction(action.x,action.y,x,y)
image_angle = direction
}
note that in this case action will ALWAYS be the same instance as the code it is on. EG
f instance_exists(Fighter) then
{
action = instance_nearest(x,y,Fighter)
move_towards_point(Fighter.x,Fighter.y,Speed)
point_direction(Fighter.x,Fighter.y,x,y)
image_angle = direction
}
(as you can see above this Fighter code will be executed by a Fighter thus causing in infinite loop)
any tips or fixes for this?
thanks ~emporer88
the code is as follows
if instance_exists(action) then
{
action = instance_nearest(x,y,action)
move_towards_point(action.x,action.y,Speed)
point_direction(action.x,action.y,x,y)
image_angle = direction
}
note that in this case action will ALWAYS be the same instance as the code it is on. EG
f instance_exists(Fighter) then
{
action = instance_nearest(x,y,Fighter)
move_towards_point(Fighter.x,Fighter.y,Speed)
point_direction(Fighter.x,Fighter.y,x,y)
image_angle = direction
}
(as you can see above this Fighter code will be executed by a Fighter thus causing in infinite loop)
any tips or fixes for this?
thanks ~emporer88