Fix: spaceship image, start random flyingsaucer

This commit is contained in:
2019-01-10 13:07:09 +09:00
parent b8faa417d8
commit 33c70e6d5c
10 changed files with 155 additions and 84 deletions
+26 -14
View File
@@ -55,10 +55,10 @@ var WordFlyingSaucer = {
this.flyingsaucers[i].setHeartManager(this.heartManager);
this.flyingsaucers[i].setExtractWordManager(this.extractWordManager);
this.flyingsaucers[i].setGameLevelManager(this.gameLevelManager);
this.flyingsaucers[i].startAttack();
// this.flyingsaucers[i].startAttack();
}
this.centerMessageText = new CenterMessageText();
// top ui
var screenTopUI = new ScreenTopUI();
@@ -93,8 +93,7 @@ var WordFlyingSaucer = {
this.screenBottomUI.printRightText(sessionStorageManager.getPlayerName());
// this.startGame();
this.showLevelUpText();
this.startGame();
},
@@ -107,6 +106,7 @@ var WordFlyingSaucer = {
initVariables: function() {
this.extractWordManager = new ExtractWordManager();
this.gameLevelManager = new GameLevelManager(this);
this.gameLevelManager.setExtractWordManager(this.extractWordManager);
this.speedLevel = 0;
@@ -144,7 +144,6 @@ var WordFlyingSaucer = {
bmd.rect(0, y, GAME_SCREEN_SIZE.x, y + GRADIATION_HEIGHT, Phaser.Color.getWebRGB(c));
y += GRADIATION_HEIGHT;
}
console.log("final y : " + y);
var stars = game.add.group();
for (var i = 0; i < 128; i++) {
@@ -153,17 +152,33 @@ var WordFlyingSaucer = {
}
var GROUND_OFFSET_Y = 600;
// this.tileSprite = game.add.tileSprite(50, GROUND_OFFSET_Y, GAME_SCREEN_SIZE.x + 50, GROUND_OFFSET_Y + 150, "tile_choco");
// this.tileSprite = game.add.tileSprite(300, 300, 100, 100, "tile_choco");
this.tileSprite = game.add.tileSprite(
GAME_SCREEN_SIZE.x, GAME_SCREEN_SIZE.y,
GAME_SCREEN_SIZE.x, 200,
GAME_SCREEN_SIZE.x, GAME_SCREEN_SIZE.y - 50,
GAME_SCREEN_SIZE.x, 100,
"tile_choco");
this.tileSprite.anchor.set(0.5);
this.tileSprite.tileScale.set(2);
},
startGame: function() {
this.showLevelUpText(this.gameLevelManager.getWordLevel()); // initial wordLevel = 0;
var startIndexList = [];
for(var i = 0; i < WordFlyingSaucer.MAX_FLYINGSAUCER_COUNT; i++)
startIndexList.push(i);
this.randomStartIndex = 0;
this.randomStartIndexList = Phaser.ArrayUtils.shuffle(startIndexList);
for(var i = 0; i < this.randomStartIndexList.length; i++) {
var randomDelayTime = Phaser.Timer.SECOND * 2 * i + Math.random() * Phaser.Timer.SECOND;
game.time.events.add(randomDelayTime, this.waitAndStartAttack, this);
}
},
waitAndStartAttack: function() {
var index = this.randomStartIndexList[this.randomStartIndex];
this.flyingsaucers[index].startAttack();
this.randomStartIndex++;
},
timeOver: function() {
@@ -224,11 +239,8 @@ var WordFlyingSaucer = {
}
},
showLevelUpText: function() {
if(this.centerMessageText)
// this.centerMessageText.text = "";
this.centerMessageText.destroy();
this.centerMessageText = new CenterMessageText("[ " + this.gameLevelManager.getWordLevelText() + " ] 단계 활성화");
showLevelUpText: function(wordLevel) {
this.centerMessageText.showText(wordLevel, this.gameLevelManager.getWordLevelText(wordLevel));
},
}