Skip to content

Movable

Isuru Kusumal Rajapakse edited this page Jun 17, 2017 · 1 revision

new Movable()

  • Represents a component that defines a behaviors like move, translate etc.
Returns
  • Void

Movable.translate(x, y)

translales the object to the given position

Parameters
Name Type Description
x int - x position to move.  
y int - y position to move.  
Returns
  • {}

Movable.move(x, y)

moves the object by the given amount

Parameters
Name Type Description
x int - x amount to move.  
y int - y amount to move.  
Returns
  • Void

Movable.velocity(x, y-)

sets the velocity of the object

Parameters
Name Type Description
x int - horizontal velocity component.  
y- int vertical velocity component.  
Returns
  • GameObject itself

Movable.accelerate(x, y-)

increases the acceleration of the object

Parameters
Name Type Description
x int - horizontal acceleration component.  
y- int vertical acceleration component.  
Returns
  • GameObject itself

Movable.force(x, y-)

applies a force to the object

Parameters
Name Type Description
x int - horizontal force component.  
y- int vertical force component.  
Returns
  • GameObject itself

Movable.process()

defines how the movable component change state on one update

Returns
  • Void

Clone this wiki locally