The camera object for the scene.
The custom data for the scene.
The game object that the scene belongs to.
The global gravity value for the scene.
An array of all the layers in the scene.
The name of the scene.
The next available render order for layers.
An array of all the objects in the scene.
The size of the scene (grid size in tiles). Default grid is canvas resolution with tile size 1px.
An array of tile collision data.
The size of each tile in the scene (default 1px).
A record of all the tiles in the scene.
Optional
tmxThe TMX map file name.
Adds a layer to the scene.
The layer to add. It can be a constructor function or an instance of TMXLayer.
Optional
order: numberThe render order of the layer. If not provided, it will be assigned the next available render order.
Adds a tileset to the scene.
The tileset to add.
The source of the tileset image.
Optional
margin?: numberOptional
spacing?: numberCreates layers and adds them to the scene.
An array of layer constructors or TMXLayer instances.
Retrieves the tile object at the specified position on the given layer. If the tile at the position is not found, it returns the tile object at index 0.
The position of the tile.
The ID of the layer.
The tile object at the specified position.
Retrieves the tile collision data at the specified position.
The position to retrieve the tile collision data from.
The tile collision data at the specified position.
Performs a raycast to check for tile collisions between two positions. Based on the DDA algorithm: https://lodev.org/cgtutor/raycasting.html
The position of the first tile hit by the raycast, or null if no collision occurred.
Removes a layer from the scene.
The layer to be removed.
Removes an object from the scene.
The object to be removed.
Sets the collision data for a tile at the specified position.
The position of the tile.
The collision data to set for the tile. Defaults to 0.
Creates a new scene object.