GitLab system status is available here and here

Commit 5de530c4 authored by Ankie Pon's avatar Ankie Pon
Browse files

tesh push -rocket effect and up not working

parent 2537a7c3
......@@ -26,6 +26,7 @@ class Rocket extends Phaser.GameObjects.Sprite {
this.isFiring = true;
//play sfx
this.sfxRocket.play();
}
//if fired move up
if(this.isFiring && this.y >= borderUISize * 3 + borderPadding) {
......
......@@ -3,7 +3,7 @@ class Spaceship extends Phaser.GameObjects.Sprite {
super(scene, x, y, texture, frame);
scene.add.existing(this);
this.points = pointValue;
this.moveSpeed = 3;
this.moveSpeed = game.settings.spaceshipSpeed;
}
update() {
......
......@@ -11,7 +11,48 @@ class Menu extends Phaser.Scene {
}
create() {
this.add.text(20, 20, "Rocket Patrol Menu");
this.scene.start("playScene");
//menu text configuration
let menuConfig = {
fontFamily: 'Courier',
fontSize: '28px',
backgroundColor: '#F3B141',
color: '#843605',
align: 'right',
padding: {
top: 5,
bottom: 5,
},
fixedWidth: 0
}
this.add.text(game.config.width/2, game.config.height/2 - borderUISize - borderPadding, 'ROCKET PATROL', menuConfig).setOrigin(0.5);
this.add.text(game.config.width/2, game.config.height/2, 'Use the <--> arrows to move and (F) to fire', menuConfig).setOrigin(0.5);
menuConfig.backgroundColor = '00FF00';
menuConfig.color = '#000';
this.add.text(game.config.width/2, game.config.height/2 + borderUISize + borderPadding, 'Press <- for Novice or -> for Expert', menuConfig).setOrigin(0.5);
// define keys
keyLEFT = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.LEFT);
keyRIGHT = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.RIGHT);
}
update() {
if (Phaser.Input.Keyboard.JustDown(keyLEFT)) {
// easy mode
game.settings = {
spaceshipSpeed: 3,
gameTimer: 60000
}
this.sound.play('sfx_select');
this.scene.start('playScene');
}
if (Phaser.Input.Keyboard.JustDown(keyRIGHT)) {
// hard mode
game.settings = {
spaceshipSpeed: 4,
gameTimer: 45000
}
this.sound.play('sfx_select');
this.scene.start('playScene');
}
}
}
\ No newline at end of file
......@@ -66,9 +66,9 @@ class Play extends Phaser.Scene {
//60 second play clock
scoreConfig.fixedWidth = 0;
this.clock = this.time.delayedCall(60000, () => {
this.clock = this.time.delayedCall(game.settings.gameTimer, () => {
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.add.text(game.config.width/2, game.config.height/2 + 64, 'Press (R) to Restart or <- for Menu', scoreConfig).setOrigin(0.5);
this.gameOver = true;
}, null, this);
}
......@@ -78,6 +78,10 @@ class Play extends Phaser.Scene {
if (this.gameOver && Phaser.Input.Keyboard.JustDown(keyR)) {
this.scene.restart();
}
if (this.gameOver && Phaser.Input.Keyboard.JustDown(keyLEFT)) {
this.scene.start("menuScene");
}
this.starfield.tilePositionX -= 4;
......
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