API Docs for: 0.5.5
Show:

kick.scene.Scene Class

A scene objects contains a list of GameObjects

Constructor

kick.scene.Scene

(
  • config
)

Parameters:

  • config Object

Methods

addNewGameObjects

() private

Handle insertions of new gameobjects and components. This is done in a separate step to avoid problems with missed updates (or multiple updates) due to modifying the array while iterating it.

cameraSortFunc

(
  • a
  • b
  • difference
)
private

Compares two camera objects by their cameraIndex attribute

Parameters:

createDefault

() kick.scene.Scene static

Create empty scene with camera

Returns:

createGameObject

(
  • [config]
)
kick.scene.GameObject

Parameters:

  • [config] Object optional

    Optionally configuration passed to the game objects

destroy

()

destroyGameObject

(
  • gameObject
)

Destroys the game object and delete it from the scene. This call will call destroy on the gameObject

Parameters:

destroyObject

(
  • gameObject
)
deprecated

Destroys the game object and delete it from the scene. This call will call destroy on the gameObject

Parameters:

findComponentsOfType

(
  • componentType
)
Array_kick.scene.Component

Search the scene for components of the specified type in the scene. Note that this method is slow - do not run in the the update function.

Parameters:

  • componentType Function

Returns:

Array_kick.scene.Component:

components

findComponentsWithMethod

(
  • methodName
)
Array_kick.scene.Component

Search the scene for components of the specified type in the scene. Note that this method is slow - do not run in the the update function.

Parameters:

  • methodName String

Returns:

Array_kick.scene.Component:

components

getGameObject

(
  • index
)
kick.scene.GameObject

Parameters:

  • index Number

getGameObjectByName

(
  • name
)
kick.scene.GameObject

Returns a GameObject identified by name

Parameters:

  • name String

Returns:

kick.scene.GameObject:

GameObject or undefined if not found

getNumberOfGameObjects

() Number

Returns:

Number:

number of gameobjects

getObjectByUID

(
  • uid
)
Object

Parameters:

  • uid Number

Returns:

Object:

GameObject or component

init

(
  • config
)

Inherited from kick.core.ProjectAsset but overwritten in kick/scene/Scene.js:440

Configures the object using the configuration data.

Parameters:

  • config Object

    configuration data in JSON format

sortByScriptPriority

(
  • a
  • b
)
Number private

Compares two objects based on scriptPriority

Returns:

Number:

order of a,b

toJSON

(
  • [filterFn]
)
Object

Inherited from kick.core.ProjectAsset but overwritten in kick/scene/Scene.js:417

Parameters:

  • [filterFn] Function optional

    Optional. Filter with function(object): return boolean, where true means include in export.

Returns:

Object:

updateAndRender

()

Called by engine every frame. Updates and render scene

Properties

engine

kick.core.Engine

Reference to the engine

name

String

Name of the scene

Events

componentAdded

Fired when a new component is added to scene

Event Payload:

componentRemoved

Fired when a new component is removed from scene

Event Payload: