El manual dice:
http://docs.yoyogames.com/source/dadiospice/002_reference/movement%20and%20collisions/movement/move_towards_point.html
Además, los dos primeros parámetros de la función son las coordenadas (x,y) absolutas a las que quieres mover el objeto, pero tú le estás pasando un ángulo, cosa que no tiene sentido.
Una solución simple sería hacer esto:
[gml]
if (keyboard_check(ord("W"))) {
x += lengthdir_x(velocidad, direction);
y += lengthdir_y(velocidad, direction);
}
if (keyboard_check(ord("S"))) {
x -= lengthdir_x(velocidad, direction);
y -= lengthdir_y(velocidad, direction);
}
[/gml]
Personalmente no me gusta usar las funciones de movimiento del GM, prefiero modificar directamente las coordenadas de los objetos.
http://docs.yoyogames.com/source/dadiospice/002_reference/maths/real%20valued%20functions/lengthdir_x.html
http://docs.yoyogames.com/source/dadiospice/002_reference/maths/real%20valued%20functions/lengthdir_y.html
CitarNote: this function sets the speed of the instance, so even if you stop using this code, the instance will keep moving in the previous direction, so it is necessary to set the instance speed to 0 if you wish it to stop. See the code example below.
http://docs.yoyogames.com/source/dadiospice/002_reference/movement%20and%20collisions/movement/move_towards_point.html
Además, los dos primeros parámetros de la función son las coordenadas (x,y) absolutas a las que quieres mover el objeto, pero tú le estás pasando un ángulo, cosa que no tiene sentido.
Una solución simple sería hacer esto:
[gml]
if (keyboard_check(ord("W"))) {
x += lengthdir_x(velocidad, direction);
y += lengthdir_y(velocidad, direction);
}
if (keyboard_check(ord("S"))) {
x -= lengthdir_x(velocidad, direction);
y -= lengthdir_y(velocidad, direction);
}
[/gml]
Personalmente no me gusta usar las funciones de movimiento del GM, prefiero modificar directamente las coordenadas de los objetos.
http://docs.yoyogames.com/source/dadiospice/002_reference/maths/real%20valued%20functions/lengthdir_x.html
http://docs.yoyogames.com/source/dadiospice/002_reference/maths/real%20valued%20functions/lengthdir_y.html