motion_set

Sets the motion of the calling object to the given direction and speed.

Syntax:

motion_set(dir, speed);


Argument Description
dir The new direction.
speed The new speed.`


Returns: N/A


Description

This function sets a new direction of movement and a new speed to the instance running the code. Note that this does not add to the instances current speed and direction (for that you would use motion_add) but rather forces it to the new settings.


Example:

if irandom(9) = 1 motion_set(random(360), 1 + random(3));

This above code will make the instance change speed and direction at random intervals.


Back: Moving Around
Next: move_towards_point
© Copyright YoYo Games Ltd. 2018 All Rights Reserved