Skip to main content

PlatformWorld

Description:

  A class representing a 2D platformer game world with physics simulations.

Class Object: Platformer.PlatformWorld Class.

Inherits from: PhysicsWorld.

camera

Type: Readonly Field.

Description:

  The camera used to control the view of the game world.

Signature:

const camera: PlatformCamera

moveChild

Type: Function.

Description:

  Moves a child node to a new order for a different layer.

Signature:

moveChild: function(self: PlatformWorld, child: Node, newOrder: integer)

Parameters:

ParameterTypeDescription
childNodeThe child node to be moved.
newOrderintegerThe new order of the child node.

getLayer

Type: Function.

Description:

  Gets the layer node at a given order.

Signature:

getLayer: function(self: PlatformWorld, order: integer): Node

Parameters:

ParameterTypeDescription
orderintegerThe order of the layer node to get.

Returns:

Return TypeDescription
NodeThe layer node at the given order.

setLayerRatio

Type: Function.

Description:

  Sets the parallax moving ratio for a given layer to simulate 3D projection effect.

Signature:

setLayerRatio: function(self: PlatformWorld, order: integer, ratio: Vec2)

Parameters:

ParameterTypeDescription
orderintegerThe order of the layer to set the ratio for.
ratioVec2The new parallax ratio for the layer.

getLayerRatio

Type: Function.

Description:

  Gets the parallax moving ratio for a given layer.

Signature:

getLayerRatio: function(self: PlatformWorld, order: integer): Vec2

Parameters:

ParameterTypeDescription
orderintegerThe order of the layer to get the ratio for.

Returns:

Return TypeDescription
Vec2The parallax ratio for the layer.

setLayerOffset

Type: Function.

Description:

  Sets the position offset for a given layer.

Signature:

setLayerOffset: function(self: PlatformWorld, order: integer, offset: Vec2)

Parameters:

ParameterTypeDescription
orderintegerThe order of the layer to set the offset for.
offsetVec2The new position offset for the layer.

getLayerOffset

Type: Function.

Description:

  Gets the position offset for a given layer.

Signature:

getLayerOffset: function(self: PlatformWorld, order: integer): Vec2

Parameters:

ParameterTypeDescription
orderintegerThe order of the layer to get the offset for.

Returns:

Return TypeDescription
Vec2The position offset for the layer.

swapLayer

Type: Function.

Description:

  Swaps the positions of two layers.

Signature:

swapLayer: function(self: PlatformWorld, orderA: integer, orderB: integer)

Parameters:

ParameterTypeDescription
orderAintegerThe order of the first layer to swap.
orderBintegerThe order of the second layer to swap.

removeLayer

Type: Function.

Description:

  Removes a layer from the game world.

Signature:

removeLayer: function(self: PlatformWorld, order: integer)

Parameters:

ParameterTypeDescription
orderintegerThe order of the layer to remove.

removeAllLayers

Type: Function.

Description:

  Removes all layers from the game world.

Signature:

removeAllLayers: function(self: PlatformWorld)