[HELP] My chickens don't eat crops

C

Candidiot

Guest
To make it simple:
I want chicken object to move toward the nearest instance of a crop spot.
Can I use id of the instance ?

Ask me if you don't understand well my request ^^
 

Humayun

Member
you can use instance_nearest(x, y, object_index) function to get the id of the nearest instance then check if instance found , if found then move towards it.
For example:
inst = instance_nearest(x, y, oCrop);
if (inst!=noone)
{
move_towars_point(inst.x,inst.y,5)
}
 
C

Candidiot

Guest
Ok so I set a variable which is the instance of an object and use it's position. Ok thax a lot :)
 
Top