【发布时间】:2021-01-01 08:17:28
【问题描述】:
我已经使用 Phaser 2 一段时间,但最近转换为 Phaser 3,我想知道是否有可能等效于“outOfBoundsKill”的方法或成员。我在 Phaser 3 中有一个 Arc Object 并对其施加了重力,我想确保它在超出画布范围时被杀死或销毁。
更多关于 outOfBoundsKill:https://phaser.io/docs/2.6.2/Phaser.Sprite.html#outOfBoundsKill
我试过这个代码示例,它没有破坏弧对象,'ball'是弧对象。
ball.on('worldbounds', function() {
if (!Over) {
ball.destroy();
HealthBar.livesLeft -= 1;
HealthBar.cs.scale.x = HealthBar.livesLeft / HealthBar.lives;
var shake = this.sound.add('shake');
shake.play();
}
}, this);
【问题讨论】:
标签: javascript phaser-framework