This function will modify the current direction and speed of the instance running the code, combining the values given with the current values. If you wish to simply change these values, you should be using the function motion_set().
motion_add(dir, speed);
| Argument | Description |
|---|---|
| dir | The added direction. |
| speed | The added speed. |
N/A
var pdir;
pdir = point_direction(other.x, other.y, x, y);
motion_add(pdir, other.speed);
if speed > 8 speed = 8;
the above code would be called in the collision event with another object. It adds to the direction of motion and the speed of the instance a vector based on the position and speed of the other instance involved in the collision. It then limits the speed if it goes over 8 (pixels per step).