ArcadeSystem

EntitySystemceramic.ArcadeSystem (Class)

Main system managing Arcade physics simulation in Ceramic.

This system integrates the Arcade physics engine with Ceramic's visual system, automatically synchronizing physics bodies with their visual representations. It manages physics worlds, groups, and handles the update cycle for all physics objects.

The system operates in two phases:

  • Early update: Updates physics simulation and processes collisions
  • Late update: Applies physics results back to visual positions

Usage example:

// Access the arcade system
var arcade = app.systems.arcade;

// Use the default world
arcade.world.gravity.y = 800;

// Create custom worlds
var customWorld = arcade.createWorld();
See: ArcadeWorld for physics world configuration, VisualArcadePhysics for adding physics to visuals

Instance Members

All active physics items in the system. Each item represents a visual with attached physics body.


arcade
worlds: Array<ArcadeWorld>

All physics worlds managed by this system. Multiple worlds can be used to create separate physics simulations (e.g., foreground and background layers with different gravity).


arcade
world: ArcadeWorld

The default physics world used when creating physics bodies. This world is automatically created and its bounds updated to match screen size when autoUpdateWorldBounds is true.


arcade
groups: Map

Named collision groups for organizing physics bodies. Groups allow efficient collision detection between specific sets of objects.

Example:

arcade.groups.set("enemies", new arcade.Group());
arcade.groups.set("bullets", new arcade.Group());
// Later: arcade.world.collide(groups.get("enemies"), groups.get("bullets"));

arcade
autoUpdateWorldBounds: Bool

When true, the default world's bounds are automatically updated to match the screen size on each frame. This ensures physics boundaries adjust when the window is resized.

Set to false if you want to manually control world bounds.


arcade
createWorld(?autoAdd: Bool = true): ArcadeWorld

Creates a new physics world with screen dimensions.

Name Type Default Description
autoAdd Bool true If true, automatically adds the world to the system's world list
Returns Description
ArcadeWorld The newly created ArcadeWorld

arcade
addWorld(world: ArcadeWorld): Void

Adds a physics world to the system. The world will be updated each frame along with other active worlds.

Name Type Description
world ArcadeWorld The ArcadeWorld to add

arcade
removeWorld(world: ArcadeWorld): Void

Removes a physics world from the system. The world will no longer be updated by the system.

Name Type Description
world ArcadeWorld The ArcadeWorld to remove

arcade
new(): Void

Creates a new ArcadeSystem instance. Automatically creates the default physics world with screen dimensions.

Private Members

arcade
emitUpdate(delta: Float): Void

Event fired after physics simulation but before results are applied. This is the ideal time to check for collisions and overlaps between bodies.

Name Type Description
delta Float Time elapsed since last frame in seconds

arcade
updateWorlds(delta: Float): Void

Updates all physics worlds with the given time delta.

Name Type Description
delta Float Time elapsed since last frame in seconds

arcade
updateWorld(world: ArcadeWorld, delta: Float): Void

Updates a single physics world.

Name Type Description
world ArcadeWorld The world to update
delta Float Time elapsed since last frame in seconds

arcade
earlyUpdate(delta: Float): Void

Early update phase: synchronizes visual properties to physics bodies and runs physics simulation.

Name Type Description
delta Float Time elapsed since last frame in seconds

arcade
lateUpdate(delta: Float): Void

Late update phase: applies physics simulation results back to visuals. This includes position updates and rotation if enabled.

Name Type Description
delta Float Time elapsed since last frame in seconds

arcade
flushDestroyedItems(): Void

Removes all items queued for destruction from the active items list.


arcade
flushCreatedItems(): Void

Adds all newly created items to the active items list.

Metadata

Name Parameters
:build tracker.macros.EventsMacro.build()
:autoBuild tracker.macros.EventsMacro.build()
:build ceramic.macros.EntityMacro.buildForCompletion()
:autoBuild ceramic.macros.EntityMacro.buildForCompletion()
:allow ceramic.App