The problem with
x+= (keyboard_check(right) - keyboard_check(left))*4
y+= (keyboard_check(down) - keyboard_check(up))*4
...simplified the math here...
I use that all the time...
is the diagonal movement is faster than straight movement; you move 1.4 units (*4 in the example ) diagonally as oppose to 1 unit (*4 in the example). Which is fine when you want to move exactly from x,y 1,1 to 5,5 for example. Dead on the grid.
But for "truer" even movement, you need to add another step
//get deviation
dx = (keyboard_check(right) - keyboard_check(left));
dy = (keyboard_check(down) - keyboard_check(up));
//translate to direction
dir = point_direction(0,0,dx,dy);
//move evenly diagonally or straight, speed 4
x+=lengthdir_x(4,dir);
y+=lengthdir_y(4,dir);
or
hspeed=lengthdir_x(4,dir);
vspeed=lengthdir_y(4,dir);
or
speed = 4
direction = dir
or
motion_set(dir,4)
Edited by icuurd12b42, 24 September 2009 - 07:40 AM.