kick.scene.Scene Class
A scene objects contains a list of GameObjects
Constructor
kick.scene.Scene
-
config
Parameters:
-
config
Object
Item Index
Methods
Events
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
Compares two camera objects by their cameraIndex attribute
Parameters:
-
a
kick.scene.Camera -
b
kick.scene.Camera -
difference
Number
createGameObject
-
[config]
Parameters:
-
[config]
Object optionalOptionally configuration passed to the game objects
Returns:
destroy
()
destroyGameObject
-
gameObject
Destroys the game object and delete it from the scene. This call will call destroy on the gameObject
Parameters:
-
gameObject
kick.scene.GameObject
destroyObject
-
gameObject
Destroys the game object and delete it from the scene. This call will call destroy on the gameObject
Parameters:
-
gameObject
kick.scene.GameObject
findComponentsOfType
-
componentType
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:
components
findComponentsWithMethod
-
methodName
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:
components
getGameObjectByName
-
name
Returns a GameObject identified by name
Parameters:
-
name
String
Returns:
GameObject or undefined if not found
getNumberOfGameObjects
()
Number
Returns:
number of gameobjects
getObjectByUID
-
uid
Parameters:
-
uid
Number
Returns:
GameObject or component
init
-
config
Configures the object using the configuration data.
Parameters:
-
config
Objectconfiguration data in JSON format
sortByScriptPriority
-
a
-
b
Compares two objects based on scriptPriority
Parameters:
Returns:
order of a,b
toJSON
-
[filterFn]
Parameters:
-
[filterFn]
Function optionalOptional. Filter with function(object): return boolean, where true means include in export.
Returns:
updateAndRender
()
Called by engine every frame. Updates and render scene
Events
componentAdded
Fired when a new component is added to scene
Event Payload:
-
component
kick.scene.Component
componentRemoved
Fired when a new component is removed from scene
Event Payload:
-
component
kick.scene.Component