Add: GameLevelManager, WordManager
This commit is contained in:
@@ -39,15 +39,19 @@ function FlyingSaucer(lineIndex) {
|
||||
this.wordText = game.add.text(0, 0, "text", style);
|
||||
this.wordText.anchor.set(0.5);
|
||||
|
||||
this.startAttack();
|
||||
|
||||
// this.setActive(true);
|
||||
this.setActive(true);
|
||||
}
|
||||
|
||||
|
||||
FlyingSaucer.prototype.initVariables = function() {
|
||||
this.isActivated = false;
|
||||
this.wordLevel = 0;
|
||||
this.speed = FlyingSaucer.DEFAULT_SPEED;
|
||||
|
||||
this.heartManager = null;
|
||||
this.wordManager = null;
|
||||
this.gameLevelManager = null;
|
||||
|
||||
this.timerEvent = null;
|
||||
}
|
||||
|
||||
@@ -84,24 +88,32 @@ FlyingSaucer.prototype.update = function() {
|
||||
this.wordText.y = this.y + FlyingSaucer.WORD_TEXT_OFFSET_Y;
|
||||
|
||||
if(this.y > GAME_SCREEN_SIZE.y - 200)
|
||||
this.moveInitialPos();
|
||||
this.crash();
|
||||
} else {
|
||||
this.stop();
|
||||
}
|
||||
}
|
||||
|
||||
FlyingSaucer.prototype.setup = function(wordLevel, speedLevel) {
|
||||
this.wordLevel = wordLevel;
|
||||
this.speedLevel = speedLevel;
|
||||
FlyingSaucer.prototype.setHeartManager = function(heartManager) {
|
||||
this.heartManager = heartManager;
|
||||
}
|
||||
|
||||
FlyingSaucer.prototype.setWordManager = function(wordManager) {
|
||||
this.wordManager = wordManager;
|
||||
}
|
||||
|
||||
FlyingSaucer.prototype.setGameLevelManager = function(gameLevelManager) {
|
||||
this.gameLevelManager = gameLevelManager;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
FlyingSaucer.prototype.setWord = function(wordText) {
|
||||
this.wordText.text = wordText;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
FlyingSaucer.prototype.stop = function() {
|
||||
this.body.velocity.setTo(0, 0);
|
||||
}
|
||||
@@ -136,7 +148,13 @@ FlyingSaucer.prototype.moveInitialPos = function() {
|
||||
|
||||
FlyingSaucer.prototype.startAttack = function() {
|
||||
this.moveInitialPos();
|
||||
this.setWord("text");
|
||||
console.log(this.wordManager);
|
||||
console.log(this.gameLevelManager);
|
||||
var wordLevel = this.gameLevelManager.getWordLevel();
|
||||
console.log(wordLevel);
|
||||
var word = this.wordManager.getWord(wordLevel);
|
||||
console.log(word);
|
||||
this.setWord(word);
|
||||
this.setActive(true);
|
||||
}
|
||||
|
||||
@@ -188,6 +206,15 @@ FlyingSaucer.prototype.explode = function(inputText) {
|
||||
this.timerEvent = game.time.events.add(Phaser.Timer.SECOND, this.startAttack, this);
|
||||
}
|
||||
|
||||
FlyingSaucer.prototype.crash = function() {
|
||||
this.moveInitialPos();
|
||||
this.heartManager.breakHearts(1);
|
||||
}
|
||||
|
||||
FlyingSaucer.prototype.destroy = function() {
|
||||
this.setActive(false);
|
||||
this.setWord("");
|
||||
}
|
||||
|
||||
|
||||
FlyingSaucer.loadResource = function() {
|
||||
|
||||
Reference in New Issue
Block a user