Fleoh
Member
Hello guys ! I'm trying to make an object follow an other object thanks to the ids.
In fact, the first instance needs to follow the player, the second instance need to follow the first instance, the third the second [...]
So i've tried this code :
In create event of the object which needs to follow
In step event of the object which needs to follow
Unfortunately, it didn't work. I don't know if it's come from the use of IDs or...
All the instances created are following the player and not the saved ID.
I've tried the same with "self" but it didn't work and when I watch the var follow, it always return 0..
Thanks for your help !
In fact, the first instance needs to follow the player, the second instance need to follow the first instance, the third the second [...]
So i've tried this code :
In create event of the object which needs to follow
Code:
if bot_number = 0 // Check if there is no object to follow except the player
{
follow = obj_player; // Follow the player
bot_range = id; // Take the id of the next object to follow
}
else // If there's an object to follow
{
follow = bot_range; // Follow the id of the last created object
bot_range = id; // Take the id of the next object to follow
}
Code:
direction = point_direction(x,y,follow.x,follow.y)
if distance_to_object(follow) > 16 {
// My code for moving...
}
All the instances created are following the player and not the saved ID.
I've tried the same with "self" but it didn't work and when I watch the var follow, it always return 0..
Thanks for your help !
Last edited: