M
MCKOY
Guest
I'm very new at this and trying to make a few simple things happen. I have two objects on screen and I'm trying to make one move towards the other but stop when it gets within a certain distance. So far I've been doing all the code inside Step. I can't get it to work correctly but when I do IF statements the game will at least run. If I try with a WHILE or DO statement, it won't run at all. Here's my examples.
Code:
if distance_to_point(obj_man, obj_orc) > 1000
{
move_towards_point(obj_orc.x, obj_orc.y, spd)
}
Code:
tdistance = distance_to_point(obj_man, obj_orc)
while (tdistance < 1000 && tdistance > 200)
{
move_towards_point(obj_orc.x, obj_orc.y, spd)
}
Code:
tdistance = distance_to_point(obj_man, obj_orc)
do (move_towards_point(obj_orc.x, obj_orc.y, spd))
until (tdistance < 200)