【发布时间】:2020-09-13 22:53:16
【问题描述】:
我正在尝试通过单击游戏的右侧或左侧来移动我的播放器。虽然在电脑上一切都很好,但当我在移动设备上尝试时,它总是向右移动,经过多次尝试后它开始向左移动,无论按哪里。这是我的update 函数:
if (game.input.activePointer.isDown)
{
if (game.input.mousePointer.x > 600)
{
player.setVelocityX(160);
player.anims.play('right', true);
}
else if (game.input.mousePointer.x < 200)
{
player.setVelocityX(-160);
player.anims.play('left', true);
}
} else {
player.setVelocityX(0);
player.anims.play('turn', true);
}
【问题讨论】:
标签: phaser-framework