Module: model/Game

model/Game

new require("model/Game")()

This:
Source:
Model of a game that takes advantage of Box2D.
Source:

Classes

require("model/Game")

Methods

addExitPath(exitPath)

Add the exit path.
This:
Parameters:
Name Type Description
exitPath Array.<Object>
Properties
Name Type Description
x number X coordinate of the cell's center.
y number Y coordinate of the cell's center.
Source:

createBall(ball) → {b2Body}

Add a ball.
This:
Parameters:
Name Type Description
ball Object
Properties
Name Type Description
x number X coordinate.
y number Y coordinate.
Source:
Returns:
The Box2D body that was created.
Type
b2Body

createContainer(width, height)

Create container edges.
This:
Parameters:
Name Type Description
width Object
height Object
Source:

createObstacle(obstacle) → {b2Body}

Create an obstacle.
This:
Parameters:
Name Type Description
obstacle Object
Properties
Name Type Description
x number X coordinate of the cell the obstacle will be placed in.
y number Y coordinate of the cell the obstacle will be placed in.
Source:
Returns:
The Box2D body that was created.
Type
b2Body

createWall(wall) → {b2Body}

Add a wall to the model.
This:
Parameters:
Name Type Description
wall Object
Properties
Name Type Description
x number X coordinate of the wall's center.
y number Y coordinate of the wall's center.
width number Width of the wall.
height number Height of the wall.
Source:
Returns:
The Box2D body that was created.
Type
b2Body

releaseHorizontalTilt()

Reset the horizontal labyrinth tilt.
This:
Source:

releaseVerticalTilt()

Reset the vertical labyrinth tilt.
This:
Source:

step(deltaTime)

Step the game model.
This:
Parameters:
Name Type Description
deltaTime number Time step that the world should progress.
Source:

tiltDown()

Tilt the labyrinth downwards.
This:
Source:

tiltLeft()

Tilt the labyrinth to the left.
Source:

tiltRight()

Tilt the labyrinth to the right.
This:
Source:

tiltUp()

Tilt the labyrinth upwards.
This:
Source: