if (x<point_x) || (x>point_x) {
direction = point_direction(x,y,point_x,y);
speed = 5;
}
else {
if (x<point_x) || (x>point_x) {
direction = point_direction(x,y,x,point_y);
speed = 5;
}
}
if (distance_to_point(point_x,point_y)<10) {
speed = 0;
}
This will make your character first going right/left and then up/down and find the requested position point_x and point_y (not being able to move in other direction than 0, 90, 180 and 270). Invert it if you would rather like to have the character to move first up/down and then left/right.
I can find plenty of situations where this might be useful. For an example, it could be a nice effect in a board game like chess. You, my important readers, often knows what you want to do with what your looking for anyway. So, good luck.
.
Users logged in:
Comments
Loading comments...