I think I was using the
move_towards_point function incorrectly. I discovered that I could not make the object move down.
In the create event, if I include the code
move_towards_point(x,y,10);, the object in question moves to the right:
If I include the code
move_towards_point(-x,y,10);, the object moves to the left:
I wanted to make the object move up, so I left
x and used
move_towards_point(x,-y,10);. It moved up as I wanted.
Yesterday, I had the need to make the object move down. That's where my dilemma began. I thought to use
move_towards_point(x,+y,10);. It did not work; the object moved to the right, as in the first demonstration. I tried
move_towards_point(0,y,0);. The object moved to the left, again, as in the second demonstration.
I began to suspect that I was not using the function correctly. By the name, I assumed it would move an object to a certain specific point. I went back to test
move_towards_point(-x,-y,0);, and the object move diagonally:
I found the solution to all cases of movement:
- Down :
- Up :
- Left :
- Right :
The explanation seems to be that I am now using the
y, relative to the object. When I do not want to change it's position on any of it's axis, I simply do not add any value. On the axis that I want the object to move in, I add or subtract a value.
One observation is that the value added or subtracted does not change the speed that the object moves, so
move_towards_point(obj_Bola.x,obj_Bola.y+99999,10); moves the object down with a speed of
I would like to know the logic behind
move_towards_point, and if the way I solved my problem is the right one.