Browse Source

修复settimeout不受游戏暂停影响引起的问题

master
jiannibang 6 years ago
parent
commit
197563cdd7
  1. 23
      games/game-flipbird/scenes/flipbird/flipbird.js

23
games/game-flipbird/scenes/flipbird/flipbird.js

@ -113,16 +113,19 @@ export default class PlayScene extends Phaser.Scene {
baseLine: "middle",
}
);
await wait1s();
this.countDown.text = 2;
await wait1s();
this.countDown.text = 1;
await wait1s();
this.countDown.destroy();
this.countDownWrapper.destroy();
this.input.on("pointerdown", this.flap, this);
this.pipeGroup.setVelocityX(-this.gameOptions.birdSpeed);
this.bird.body.gravity.y = this.gameOptions.birdGravity;
this.time.delayedCall(1000, () => {
this.countDown.text = 2;
this.time.delayedCall(1000, () => {
this.countDown.text = 1;
this.time.delayedCall(1000, () => {
this.countDown.destroy();
this.countDownWrapper.destroy();
this.input.on("pointerdown", this.flap, this);
this.pipeGroup.setVelocityX(-this.gameOptions.birdSpeed);
this.bird.body.gravity.y = this.gameOptions.birdGravity;
});
});
});
}
updateScore(inc) {
this.score += inc;

Loading…
Cancel
Save