API Documentation for: 0.11.8
Show:

platypus.Game Class

Defined in: platypus.Game:1
Module: platypus

This class is used to create the platypus.game object and loads the Platypus game as described by the game configuration files.

Constructor

platypus.Game

(
  • definition
  • applicationInstance
  • [onFinishedLoading]
)
platypus.Game

Defined in platypus.Game:1

Parameters:

  • definition Object

    Collection of configuration settings, typically from config.json.

  • applicationInstance springroll.Application

    The Spring Roll application that the Platypus game is in.

  • [onFinishedLoading] Function optional

    An optional function to run once the game has begun.

Returns:

platypus.Game:

Returns the instantiated game.

Methods

destroy

()

Defined in destroy:257

This method destroys the game.

getEntitiesByType

(
  • type
)
Array

This method will return all game entities that match the provided type.

Parameters:

  • type String

    The entity type to find.

Returns:

Array:

entities Returns the entities that match the specified entity type.

getEntityById

(
  • id
)
platypus.Entity

Defined in getEntityById:227

This method will return the first entity it finds with a matching id.

Parameters:

  • id String

    The entity id to find.

Returns:

platypus.Entity:

Returns the entity that matches the specified entity id.

loadScene

(
  • sceneId
  • transition="instant"
  • data
  • preloading=false
)

Defined in loadScene:193

Loads a scene.

Parameters:

  • sceneId String

    The scene to load.

  • transition="instant" String

    What type of transition to make. Currently there are: 'fade-to-black', 'crossfade', and 'instant'.

  • data Object

    A list of key/value pairs describing options or settings for the loading scene.

  • preloading=false Boolean

    Whether the scene should appear immediately or just be loaded and not shown.

tick

(
  • tickEvent
)

Defined in tick:180

This method causes the game to tick once. It's called by the SpringRoll Application.

Parameters:

  • tickEvent Object

    Key/value pairs passed on to the current scene.

    • delta Number

      The time elapsed since the last tick.