GML Need help with this code.

So ive set a creation event to a obj. it sets a var named "move" to true.
Then I added an even that has this
if(move)
{
move_towards_point(100,100,2);
}

if (distance_to_point(100,100) < 5)
{
move_towards_point(200,200,5);
move = false;
}

It should stop the "obj" from moving but it just shakes like crazy in one spot and doesnt end and move to the next target. I would like to know how to stop the first if statement, and once "position" is reached and it will move to the next position/ if statement.
 
L

Lonewolff

Guest
Doesn't appear the second 'if' statement is ever getting called. I'd throw a debug message in there to make sure.

Looks like your code is stuck on moving to 100, 100.


[edit]
The manual does say this though. Unsure if it relates to your circumstances.

Note that if the calling object have no sprite or no mask defined, the results will be incorrect.
@Nocturne - 'has' might be better than 'have' in this case, where the manual is concerned. :)
 
Last edited:
Oh
Doesn't appear the second 'if' statement is ever getting called. I'd throw a debug message in there to make sure.

Looks like your code is stuck on moving to 100, 100.


[edit]
The manual does say this though. Unsure if it relates to your circumstances.



@Nocturne - 'has' might be better than 'have' in this case, where the manual is concerned. :)
thank you it seems that the mask was off center for some unknown reason, along with the origin point.
 
Top