• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

[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