From 197563cdd72044f5685d040bce5219a37ea5a463 Mon Sep 17 00:00:00 2001 From: jiannibang Date: Thu, 10 Sep 2020 14:39:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dsettimeout=E4=B8=8D=E5=8F=97?= =?UTF-8?q?=E6=B8=B8=E6=88=8F=E6=9A=82=E5=81=9C=E5=BD=B1=E5=93=8D=E5=BC=95?= =?UTF-8?q?=E8=B5=B7=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../game-flipbird/scenes/flipbird/flipbird.js | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/games/game-flipbird/scenes/flipbird/flipbird.js b/games/game-flipbird/scenes/flipbird/flipbird.js index 418555e..f54441f 100644 --- a/games/game-flipbird/scenes/flipbird/flipbird.js +++ b/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;