Class: Scene

Scene.Scene

new Scene.Scene (game)

Scene class. (World class in other engines)
Name Type Description
game Core.Game the game object

Members

paused Boolean

is scene paused

physicsEngine Physics.PhysicsEngine

scene's physics engine

Methods

addEntity (entity)Boolean

adds entity
Name Type Description
entity Core.Entity the entity to add
Returns:
Type Description
Boolean true if added, false otherwise.

createEntity (name, x, y, firstChild)Core.Entity

creates entity
Name Type Description
name String entity name
x Number the x position
y Number the y position
firstChild object entity's first child
Returns:
Type Description
Core.Entity the newly created entity

createManualEntity (name, x, y, firstChild)Core.Entity

creates manual entity (does not render, update automatically etc.)
Name Type Description
name String entity name
x Number the x position
y Number the y position
firstChild object entity's first child
Returns:
Type Description
Core.Entity the newly created entity

createNewEntity (firstChild)Core.Entity

creates new entity
Name Type Description
firstChild object entity's first child
Returns:
Type Description
Core.Entity the newly created entity

delEntity (entityName)Boolean

deletes an entity from scene
Name Type Description
entityName String The entity's name
Returns:
Type Description
Boolean True if deleted, false otherwise.

deserialize (data)

loads scene from serialized data
Name Type Description
data Object the data

getChildName (parent, child)String

generates child name
Name Type Description
parent Core.Entity parent entity
child object child object/entity
Returns:
Type Description
String the generated name

getEntity (name)Core.Entity

gets entity by name
Name Type Description
name String entity name
Returns:
Type Description
Core.Entity entity if found, null otherwise.

getEntityName ()String

generates entity name
Returns:
Type Description
String the generated name.

onFileDrop (file)

the file drop handler
Name Type Description
file String file data

pause ()

pause game

render ()Boolean

renders scene
Returns:
Type Description
Boolean true if rendered, false otherwise.

resume ()

resume scene

serialize ()Object

serialize scene data
Returns:
Type Description
Object scene data representation object

update ()Boolean

updates scene (advance tick)
Returns:
Type Description
Boolean updated