Skip to content

Phaser.Physics.Arcade.Components.Velocity ​

Phaser v4.1.0 · 英文原文

Scope: static

源码:src/physics/arcade/components/Velocity.js#L7
引入版本:3.0.0

静态函数 ​

setMaxVelocity ​

<instance> setMaxVelocity(x, [y]) ​

说明:

设定物理体的最大速度。

参数:

名称类型可选默认值说明
xnumber否新的最大水平速度,以每秒像素计.
ynumber是"x"新的最大垂直速度,以每秒像素计.

返回值: Phaser.Physics.Arcade.Components.Velocity - 此游戏对象 。

源码:src/physics/arcade/components/Velocity.js#L73
引入版本:3.0.0


setVelocity ​

<instance> setVelocity(x, [y]) ​

说明:

设定物理体的速度。

参数:

名称类型可选默认值说明
xnumber否物理体的横向速度,以像素每秒为单位。正值将物理体移到右边,负值则移到左边。
ynumber是"x"物理体的垂直速度, 以像素每秒为单位。 正值将物理体向下移动, 而负值则向上移动 。

返回值: Phaser.Physics.Arcade.Components.Velocity - 此游戏对象 。

源码:src/physics/arcade/components/Velocity.js#L17
引入版本:3.0.0


setVelocityX ​

<instance> setVelocityX(x) ​

说明:

设置物理体速度的横向组成部分。

正值将正体移到右边,负值则移到左边.

参数:

名称类型可选说明
xnumber否新的水平速度,以像素每秒为单位.

返回值: Phaser.Physics.Arcade.Components.Velocity - 此游戏对象 。

源码:src/physics/arcade/components/Velocity.js#L35
引入版本:3.0.0


setVelocityY ​

<instance> setVelocityY(y) ​

说明:

设置物理体速度的垂直组成部分。

正值将正体向下移动,而负值则向上移动.

参数:

名称类型可选说明
ynumber否新的垂直速度,以像素每秒为单位.

返回值: Phaser.Physics.Arcade.Components.Velocity - 此游戏对象 。

源码:src/physics/arcade/components/Velocity.js#L54
引入版本:3.0.0



社区翻译