Fix: group -> array, tint grey while disbled
This commit is contained in:
@@ -21,18 +21,17 @@ class Game {
|
||||
|
||||
|
||||
// contents
|
||||
this.alienGroup = game.add.group();
|
||||
this.alienGroup.inputEnableChildren = true;
|
||||
this.activatedAlienIndex = 0;
|
||||
this.aliens = [];
|
||||
for(let i = 0; i < 10; i++) {
|
||||
let alien = new Alien(150 + 80 * i, 150, this.onAlienFired, this.onAlienFired);
|
||||
let alien = new Alien(150 + 80 * i, 150,
|
||||
() => { this.activateNextAlien(); }, // onGoOnstage
|
||||
this.onAlienFired, this.onAlienEscaped);
|
||||
alien.goWaitingRoom();
|
||||
alien.setActive(false);
|
||||
this.alienGroup.add(alien);
|
||||
this.aliens.push(alien);
|
||||
}
|
||||
|
||||
// activate first alien
|
||||
// this.alienGroup[0].setActive(true);
|
||||
|
||||
|
||||
// bottom
|
||||
let screenBottom = new ScreenBottom(game);
|
||||
@@ -78,15 +77,23 @@ class Game {
|
||||
*/
|
||||
|
||||
startGame() {
|
||||
console.log("startGame");
|
||||
// activate first alien
|
||||
this.activateNextAlien();
|
||||
}
|
||||
|
||||
onAlienFired(sprite) {
|
||||
activateNextAlien() {
|
||||
if(this.activatedAlienIndex === this.aliens.length)
|
||||
return;
|
||||
|
||||
this.aliens[this.activatedAlienIndex].setActive(true);
|
||||
this.activatedAlienIndex++;
|
||||
}
|
||||
|
||||
onAlienFired() {
|
||||
console.log("onAlienFired");
|
||||
sprite.goOnstage();
|
||||
}
|
||||
|
||||
onAlienEscaped(sprite) {
|
||||
onAlienEscaped() {
|
||||
console.log("onAlienEscaped");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user