【发布时间】:2017-05-23 09:29:33
【问题描述】:
在此链接上有一个使用 Phaser 开发的游戏示例 http://examples.phaser.io。 你的坦克是一个带有炮塔精灵的精灵:
// The base of our tank
tank = game.add.sprite(0, 0, 'tank', 'tank1');
tank.anchor.setTo(0.5, 0.5);
...
// Finally the turret that we place on-top of the tank body
turret = game.add.sprite(0, 0, 'tank', 'turret');
turret.anchor.setTo(0.3, 0.5);
..
还要注意每帧执行的更新函数中的以下内容:
turret.x = tank.x;
turret.y = tank.y;
请注意,当您加速时,炮塔会稍微滞后,并且仅在您达到零速度时才赶上底层坦克精灵。如何解决这个问题?
【问题讨论】:
标签: phaser-framework