GDP Functions


Position

Rotation

Scale

Collision

Appearance

Timers

Animation

Attributes

Miscellaneous

Rotation

spin()

The function spin() will spin an object with a specified speed. spin() takes in two parameters, an object and a speed. As always, this speed can be negative, for opposite rotation.

spin(object,10);    
//spins 'object' with a speed of 10

See Further:

  1. Spin a Star
  2. Spin Counter-Clockwise
  3. Star Spinner

.rotation()

The function .rotation() will set an object's rotation. The function makes use of the rotation attribute, that can be found within the properties menu. The function .rotation() takes in one parameter, the degree in which an object will be rotated. Of note, is the amount of degrees in a full circle is 360.

object.rotation(10);    
//sets the rotation of the object to 10 degrees

See Further:

  1. Wall Blaster 2
  2. Degrees in Circle

.flipDirection()

The function .flipDirection() will turn an object to the opposite direction. The function takes in no parameters, it will simply just rotate the object 180 degrees from where it is currently facing.

object.flipDirection();    
//flips 'object' to the opposite direction

See Further:

  1. Bumper Car
  2. Balloon Project

.pointTo()

The function .pointTo() will point an object in the direction of a coordinate. The function takes in two parameters, the x and y coordinates of a position.

object.pointTo(10,10);    
//points 'object' to the direction of (10,10)

See Further:

  1. Shuriken Toss Part 2

.pointToCursor()

The function .pointToCursor() will point an object in the direction of the mouse pointer. The function takes in no parameters.

object.pointToCursor();    
//points 'object' in the direction of the mouse pointer

See Further:

  1. Shuriken Toss Part 2

.pointToObject()

The function .pointToObject() will point an object in the direction of another item. The function takes in one parameter, the destination object.

object.pointToObject(object2);    
//points 'object' in the direction of 'object2'

See Further:

  1. Ninja Battle