GitLab system status is available here and here

Commit 9c712c27 authored by Ankie Pon's avatar Ankie Pon
Browse files

finished up to restart

parent eb30fdf0
......@@ -61,23 +61,36 @@ class Play extends Phaser.Scene {
}
this.scoreLeft = this.add.text(borderUISize + borderPadding, borderUISize + borderPadding*2, this.p1Score, scoreConfig);
//game over flag
this.gameOver = false;
//60 second play clock
scoreConfig.fixedWidth = 0;
this.clock = this.time.delayedCall(60000, () => {
this.clock = this.time.delayedCall(3000, () => {
this.add.text(game.config.width/2, game.config.height/2, 'GAME OVER', scoreConfig).setOrigin(0.5);
this.add.text(game.config.width/2, game.config.height/2 + 64, 'Press (R) to Restart', scoreConfig).setOrigin(0.5);
this.gameOver = true;
}, null, this);
}
update() {
//check key input for restart
if (this.gameOver && Phaser.Input.Keyboard.JustDown(keyR)) {
this.scene.restart();
}
this.starfield.tilePositionX -= 4;
//update the rocket
this.p1Rocket.update();
if (!this.gameOver) {
//update the rocket
this.p1Rocket.update();
//update the spaceships
this.ship01.update();
this.ship02.update();
this.ship03.update();
//update the spaceships
this.ship01.update();
this.ship02.update();
this.ship03.update();
}
//check collisions
if(this.checkCollision(this.p1Rocket, this.ship03)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment