Creé un script paraque el personaje se moviera hacía adelante y atras con W y S, y con las teclas A y D rotará para cambiar el curso, pero aún soltando la tecla W o S sigue avanzando
[gml]//velocidad de personaje
velocidad=3;
//Rotacion de personaje
if (keyboard_check(ord("A"))) {image_angle = direction++;
direction = image_angle +10}
if (keyboard_check(ord("D"))) {image_angle = direction--;
direction = image_angle -10;}
//Movimiento de personaje hacia su dirrecion actual
if (keyboard_check(ord("W"))) {move_towards_point(direction, direction, velocidad);
direction=image_angle;}
if (keyboard_check(ord("S"))) {move_towards_point(direction, direction, -velocidad);
direction=image_angle;}
[/gml]
El manual dice:
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
Gracias :D, me estoy pasando del drag and drop a escribir el codigo directamente, soy muy novato xD