ArcadeSystem
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();
Instance Members
All active physics items in the system. Each item represents a visual with attached physics body.
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).
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.
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"));
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.
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 |
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 |
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 |
Creates a new ArcadeSystem instance. Automatically creates the default physics world with screen dimensions.
Private Members
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 |
Updates all physics worlds with the given time delta.
Name | Type | Description |
---|---|---|
delta |
Float | Time elapsed since last frame in seconds |
Updates a single physics world.
Name | Type | Description |
---|---|---|
world |
ArcadeWorld | The world to update |
delta |
Float | Time elapsed since last frame in seconds |
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 |
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 |
Removes all items queued for destruction from the active items list.
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 |