scene¶
- class scene
A high level scene structure used that integrates object hierarchy, rendering, input, physics and serialisation to simplify and streamline games and simulations
- main: scene¶
Sets the main Codea scene, which will be automatically drawn, updated and handle touch events
function setup() scene.main = scene.default3d() end
- world2d: physics2d.world¶
Gets the scene’s 2D physics world, providing access to various physics functions and properties such as
physics2d.world.applyForce()
- world3d: physics3d.world¶
Gets the scene’s 3D physics world, providing access to various physics functions and properties such as
physics3d.world.applyForce()
- sky: None¶
Sets the sky visuals, which will depend on the type used:
asset.key
- Use an image pointed to by a given asset keyimage
- Use an image directly (assumed to be a cube image)color
- Use a solid color
- findEntity(name)¶
- entities([activeOnly = true])¶
Returns a table containing all root entities
- Parameters
activeOnly – When set, returns only active root entities
- index(name) [metamethod]
Returns the root entity with the given name (if it exists)
- draw()¶
Immediately draws the scene to the current context. When autoUpdate is enabled,
update(dt)
will be called as wellIf set as
scene.main
this will be called automatically right before the globaldraw()
function
- update(deltaTime)¶
Updates the scene, called automatically when
draw()
is called but can also be called manutally if needed