J
Jason Pickel
Guest
Hello. So I'm making a platformer, and I've been having an issue with this one part where I'm trying to get an object to randomly go to 1 of 3 areas and turn into something else.
I've been using this code, and it works relatively well, aside from that sometimes the object spawns and stays there, and when the object goes to the 3rd spot, it spawns a bit under where the others do.
if irandom_range(0,2) = 0
{
move_towards_point(obj_spawn.x, obj_spawn.y, spd);
}
else
if irandom_range(0,2) = 1
{
move_towards_point(obj_spawn2.x, obj_spawn2.y, spd);
}
else
if irandom_range(0,2) = 2
{
move_towards_point(obj_spawn3.x, obj_spawn3.y, spd);
}
If anybody has any thoughts on how I could fix this, or how amateur it is, I'd love the feedback
Thank you!
I've been using this code, and it works relatively well, aside from that sometimes the object spawns and stays there, and when the object goes to the 3rd spot, it spawns a bit under where the others do.
if irandom_range(0,2) = 0
{
move_towards_point(obj_spawn.x, obj_spawn.y, spd);
}
else
if irandom_range(0,2) = 1
{
move_towards_point(obj_spawn2.x, obj_spawn2.y, spd);
}
else
if irandom_range(0,2) = 2
{
move_towards_point(obj_spawn3.x, obj_spawn3.y, spd);
}
If anybody has any thoughts on how I could fix this, or how amateur it is, I'd love the feedback
Thank you!