In game maker specifically you may use following:
direction = point_direction(x, y, x+x_speed, y+y_speed) speed = point_distance(x, y, x+x_speed, y+y_speed)
(compare current and future x/y coordinates and return values)
Reverse the process to get x/y_speed:
x_speed = lengthdir_x(speed, direction) y_speed = lengthdir_y(speed, direction) Note: Added this post because its still viewed in relation to Game Maker: Studio and its specific functions. Maybe it has no value for the person who asked originally but i hope it will help some Game Maker users who wander here
6 comments