GDP Functions


Position

Rotation

Scale

Collision

Appearance

Timers

Animation

Attributes

Miscellaneous

Miscellaneous

isKeyPressed()

The function isKeyPressed() will return whether a specified key is being pressed. The function takes in one parameter, 'Keys.' and then the desired key.

var pressed = isKeyPressed(Keys.space) 
//sets the variable 'pressed' to whether the 'space' key is being pressed

See Further:

  1. Rain Catcher Part 2
  2. Basic Pong With Keyboard

.clone()

The function .clone() will create a copy of an object. The function takes in no parameters.

object.clone();    
//clones 'object

See Further:

  1. Rain Catcher Part 4
  2. Meteors Part 2

.remove()

The function .remove() will remove an object. The function takes in no parameters.

object.remove();    
//removes 'object'

See Further:

  1. Starscape
  2. Zapper Part 1


random()

The function random will return a random number within a range. The function takes in two parameters. The first number in the range, and the final number in the range.

var random = random(1,100)  
//sets variable 'random' to a random number between 1 and 100

See Further:

  1. Rain Catcher Part 3
  2. Shooting Stars