Class: Game

Game


new Game()

Game is the main hub for a game. A game made with LesserPanda
is a combination of different Games(menu, shop, game, game-over .etc).

Source:

Extends

  • EvenetEmitter

Members


desiredFPS

Desired FPS this scene should run

Properties:
Name Type Description
desiredFPS Number
Default Value:
  • 60
Source:

entities :Array.<Entity>

List of entities in the game world.

Type:
Source:

namedEntities :Object

Holding all the named entities(has name been set).

Type:
  • Object
Source:

systemOrder

List of system updating order.
Note: systemOrder should only be modified after systems added!

Properties:
Name Type Description
systemOrder Array.<String>
Source:

systems

Map of added systems

Properties:
Name Type Description
systems Object
Source:

taggedEntities :Object

Holding all the tagged entities(has tag been set).

Type:
  • Object
Source:

Methods


addSystem(sys)

Add a system instance to this game.

Parameters:
Name Type Description
sys System

System instance to add

Source:
Returns:

Self for chaining

Type
Game

awake()

Awake is called when this scene is activated.

Source:

fixedUpdate(delta, deltaSec)

Fixed update is called in a constant frenquence decided by desiredFPS.

Parameters:
Name Type Description
delta Number

Delta time in millisecond

deltaSec Number

Delta time in second

Source:

freeze()

Freeze is called when this scene is deactivated(switched to another one)

Source:

pause()

System pause callback.

Source:

resize(w, h)

Resize callback.

Parameters:
Name Type Description
w Number

New window width

h Number

New window height

Source:

resume()

System resume callback.

Source:

<protected> run(timestamp)

Called each single frame by engine core, support both idle and fixed update.
Using a modified fixed update implementation from Phaser by @photonstorm

Parameters:
Name Type Description
timestamp Number

Timestamp at this invoking

Source:

spawnEntity(type, x, y, layer, settings)

Spawn an Entity into game world.

Parameters:
Name Type Description
type Class

Entity class

x Number

X coordinate

y Number

Y coordinate

layer String

Name of the layer to added to

settings Object

Instance settings

Source:
Returns:

Entity instance

Type
Entity

update(delta, deltaSec)

Update is called every single frame.

Parameters:
Name Type Description
delta Number

Delta time in millisecond

deltaSec Number

Delta time in second

Source:

Class: Game

Game


new Game()

Source:

Members


desiredFPS

Desired FPS this scene should run

Properties:
Name Type Description
desiredFPS Number
Default Value:
  • 60
Source:

entities :Array.<Entity>

List of entities in the game world.

Type:
Source:

namedEntities :Object

Holding all the named entities(has name been set).

Type:
  • Object
Source:

systemOrder

List of system updating order.
Note: systemOrder should only be modified after systems added!

Properties:
Name Type Description
systemOrder Array.<String>
Source:

systems

Map of added systems

Properties:
Name Type Description
systems Object
Source:

taggedEntities :Object

Holding all the tagged entities(has tag been set).

Type:
  • Object
Source:

Methods


addSystem(sys)

Add a system instance to this game.

Parameters:
Name Type Description
sys System

System instance to add

Source:
Returns:

Self for chaining

Type
Game

awake()

Awake is called when this scene is activated.

Source:

fixedUpdate(delta, deltaSec)

Fixed update is called in a constant frenquence decided by desiredFPS.

Parameters:
Name Type Description
delta Number

Delta time in millisecond

deltaSec Number

Delta time in second

Source:

freeze()

Freeze is called when this scene is deactivated(switched to another one)

Source:

pause()

System pause callback.

Source:

resize(w, h)

Resize callback.

Parameters:
Name Type Description
w Number

New window width

h Number

New window height

Source:

resume()

System resume callback.

Source:

<protected> run(timestamp)

Called each single frame by engine core, support both idle and fixed update.
Using a modified fixed update implementation from Phaser by @photonstorm

Parameters:
Name Type Description
timestamp Number

Timestamp at this invoking

Source:

spawnEntity(type, x, y, layer, settings)

Spawn an Entity into game world.

Parameters:
Name Type Description
type Class

Entity class

x Number

X coordinate

y Number

Y coordinate

layer String

Name of the layer to added to

settings Object

Instance settings

Source:
Returns:

Entity instance

Type
Entity

update(delta, deltaSec)

Update is called every single frame.

Parameters:
Name Type Description
delta Number

Delta time in millisecond

deltaSec Number

Delta time in second

Source: