Fix: space invaders game ES5 bug
This commit is contained in:
@@ -1,9 +1,6 @@
|
|||||||
/////////////////////////////
|
var Game = {
|
||||||
// Space invaders game
|
|
||||||
|
|
||||||
class Game {
|
create: function() {
|
||||||
|
|
||||||
create() {
|
|
||||||
this.game.stage.backgroundColor = "#000000"; // '#4d4d4d';
|
this.game.stage.backgroundColor = "#000000"; // '#4d4d4d';
|
||||||
|
|
||||||
sessionStorageManager.setIsNewBestRecord(false);
|
sessionStorageManager.setIsNewBestRecord(false);
|
||||||
@@ -79,10 +76,10 @@ class Game {
|
|||||||
|
|
||||||
this.startGame();
|
this.startGame();
|
||||||
// this.countDown();
|
// this.countDown();
|
||||||
}
|
},
|
||||||
|
|
||||||
initListeners() {
|
initListeners: function() {
|
||||||
}
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
countDown() {
|
countDown() {
|
||||||
@@ -115,32 +112,32 @@ class Game {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
startGame() {
|
startGame: function() {
|
||||||
// activate first alien
|
// activate first alien
|
||||||
this.alienTimer.start();
|
this.alienTimer.start();
|
||||||
}
|
},
|
||||||
|
|
||||||
gameOver() {
|
gameOver: function() {
|
||||||
this.alienTimer.stop();
|
this.alienTimer.stop();
|
||||||
|
|
||||||
var gameOverText = new GameOverText();
|
var gameOverText = new GameOverText();
|
||||||
|
|
||||||
game.time.events.add(Phaser.Timer.SECOND * 2, this.goResult, this);
|
game.time.events.add(Phaser.Timer.SECOND * 2, this.goResult, this);
|
||||||
}
|
},
|
||||||
|
|
||||||
goResult() {
|
goResult: function() {
|
||||||
location.href = '../../web/client/result.html';
|
location.href = '../../web/client/result.html';
|
||||||
}
|
},
|
||||||
|
|
||||||
activateNextAlien() {
|
activateNextAlien: function() {
|
||||||
this.alienTimer.next();
|
this.alienTimer.next();
|
||||||
}
|
},
|
||||||
|
|
||||||
getScore() {
|
getScore: function() {
|
||||||
return (this.alienTimer.activatedAlienIndex) * 2;
|
return (this.alienTimer.activatedAlienIndex) * 2;
|
||||||
}
|
},
|
||||||
|
|
||||||
onAlienEscaped() {
|
onAlienEscaped: function() {
|
||||||
heartManager.breakHearts(1);
|
heartManager.breakHearts(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ var Start = {
|
|||||||
this.makeStartButton();
|
this.makeStartButton();
|
||||||
this.makeRankingButton();
|
this.makeRankingButton();
|
||||||
|
|
||||||
console.log(sessionStorageManager.getMaestroAccountType());
|
|
||||||
if(sessionStorageManager.getMaestroAccountType() >= 100) { // experience account
|
if(sessionStorageManager.getMaestroAccountType() >= 100) { // experience account
|
||||||
this.printSampleChart();
|
this.printSampleChart();
|
||||||
this.announceBox = new AnnounceBox(50, 648);
|
this.announceBox = new AnnounceBox(50, 648);
|
||||||
|
|||||||
Reference in New Issue
Block a user