-
-
Notifications
You must be signed in to change notification settings - Fork 18
motion_add
drewmccluskey edited this page Feb 10, 2019
·
6 revisions
Moves object in a given relative direction at a given relative speed
motion_add(dir, speed)
Argument | Description |
---|---|
double dir |
Relative direction to move |
double speed |
Relative speed for object |
Returns: void
This function increases or decreases the direction and speed for the object in which it is called. Speed is defined as pixels per call or step. It is key to mention this function always uses the directional and speed inputs as additions rather than as set variables.
motion_set(90,2);
motion_add(180, 4);
The above code will first set the objects direction upwards with a speed of 2 pixels per inch and then on the next line it will increase the objects direction by 180 degrees as well as increase the speed by 4, resulting in a total direction of 270 and a speed of 6.
Back to Movement