【发布时间】:2021-12-21 14:09:59
【问题描述】:
我有一个可以点击移动的角色。我正在使用 MoveToObject 我想根据它的移动方向为精灵实现动画,类似于下面的代码 sn-p
if (this.cursors.left.isDown)
{
this.player.setVelocity(-speed, 0)
this.player.play('left-walk', true)
}
else if (this.cursors.right.isDown)
{
this.player.setVelocity(speed, 0)
this.player.play('right-walk', true)
}
else if (this.cursors.up.isDown)
{
this.player.setVelocity(0, -speed)
this.player.play('up-walk', true)
}
else if (this.cursors.down.isDown)
{
this.player.setVelocity(0, speed)
this.player.play('down-walk', true)
}
我猜想得到精灵的当前角度,但我似乎无法让它工作。谢谢
【问题讨论】:
标签: javascript phaser-framework