代码拉取完成,页面将自动刷新
# PlatformWorld
**Description:**
  A class representing a 2D platformer game world with physics simulations.
**Class Object:** [Platformer.PlatformWorld Class](/docs/api/Class%20Object/Platformer/PlatformWorld).
**Inherits from:** [PhysicsWorld](/docs/api/Class/PhysicsWorld).
## camera
**Type:** Readonly Field.
**Description:**
  The camera used to control the view of the game world.
**Signature:**
```tl
const camera: PlatformCamera
```
## moveChild
**Type:** Function.
**Description:**
  Moves a child node to a new order for a different layer.
**Signature:**
```tl
moveChild: function(self: PlatformWorld, child: Node, newOrder: integer)
```
**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| child | Node | The child node to be moved. |
| newOrder | integer | The new order of the child node. |
## getLayer
**Type:** Function.
**Description:**
  Gets the layer node at a given order.
**Signature:**
```tl
getLayer: function(self: PlatformWorld, order: integer): Node
```
**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| order | integer | The order of the layer node to get. |
**Returns:**
| Return Type | Description |
| --- | --- |
| Node | The 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:**
```tl
setLayerRatio: function(self: PlatformWorld, order: integer, ratio: Vec2)
```
**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| order | integer | The order of the layer to set the ratio for. |
| ratio | Vec2 | The new parallax ratio for the layer. |
## getLayerRatio
**Type:** Function.
**Description:**
  Gets the parallax moving ratio for a given layer.
**Signature:**
```tl
getLayerRatio: function(self: PlatformWorld, order: integer): Vec2
```
**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| order | integer | The order of the layer to get the ratio for. |
**Returns:**
| Return Type | Description |
| --- | --- |
| Vec2 | The parallax ratio for the layer. |
## setLayerOffset
**Type:** Function.
**Description:**
  Sets the position offset for a given layer.
**Signature:**
```tl
setLayerOffset: function(self: PlatformWorld, order: integer, offset: Vec2)
```
**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| order | integer | The order of the layer to set the offset for. |
| offset | Vec2 | The new position offset for the layer. |
## getLayerOffset
**Type:** Function.
**Description:**
  Gets the position offset for a given layer.
**Signature:**
```tl
getLayerOffset: function(self: PlatformWorld, order: integer): Vec2
```
**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| order | integer | The order of the layer to get the offset for. |
**Returns:**
| Return Type | Description |
| --- | --- |
| Vec2 | The position offset for the layer. |
## swapLayer
**Type:** Function.
**Description:**
  Swaps the positions of two layers.
**Signature:**
```tl
swapLayer: function(self: PlatformWorld, orderA: integer, orderB: integer)
```
**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| orderA | integer | The order of the first layer to swap. |
| orderB | integer | The order of the second layer to swap. |
## removeLayer
**Type:** Function.
**Description:**
  Removes a layer from the game world.
**Signature:**
```tl
removeLayer: function(self: PlatformWorld, order: integer)
```
**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| order | integer | The order of the layer to remove. |
## removeAllLayers
**Type:** Function.
**Description:**
  Removes all layers from the game world.
**Signature:**
```tl
removeAllLayers: function(self: PlatformWorld)
```
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。