32 Star 227 Fork 40

GVPI++俱乐部/Dora-SSR

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
PlatformWorld.mdx 3.88 KB
一键复制 编辑 原始数据 按行查看 历史
Li Jin 提交于 2025-01-06 16:24 +08:00 . Fixed doc site prismjs language adding. [skip CI]
# 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)
```
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/ippclub/Dora-SSR.git
git@gitee.com:ippclub/Dora-SSR.git
ippclub
Dora-SSR
Dora-SSR
main

搜索帮助