Wizard
This commit is contained in:
parent
b5828b22ec
commit
ed5e96d053
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -15,8 +15,8 @@ export class GameScene extends Phaser.Scene {
|
||||||
|
|
||||||
// Stats
|
// Stats
|
||||||
this.numberOfJewels = 4;
|
this.numberOfJewels = 4;
|
||||||
this.startRows = 5;
|
this.startRows = 2;
|
||||||
this.level = 1;
|
this.level = 12;
|
||||||
this.matchesNeeded = 8;
|
this.matchesNeeded = 8;
|
||||||
this.score = 0;
|
this.score = 0;
|
||||||
this.ally = 'goblin';
|
this.ally = 'goblin';
|
||||||
|
|
@ -65,7 +65,7 @@ export class GameScene extends Phaser.Scene {
|
||||||
this.load.audio('alarm', 'assets/alarm.mp3');
|
this.load.audio('alarm', 'assets/alarm.mp3');
|
||||||
|
|
||||||
// Ally Assets
|
// Ally Assets
|
||||||
const allys = ['goblin', 'surfer', 'bear'];
|
const allys = ['goblin', 'surfer', 'bear', 'wizard'];
|
||||||
allys.forEach((ally) => {
|
allys.forEach((ally) => {
|
||||||
this.load.video(`${ally}-resting`, `assets/${ally}-resting.mp4`);
|
this.load.video(`${ally}-resting`, `assets/${ally}-resting.mp4`);
|
||||||
this.load.video(`${ally}-excited`, `assets/${ally}-excited.mp4`);
|
this.load.video(`${ally}-excited`, `assets/${ally}-excited.mp4`);
|
||||||
|
|
@ -1069,6 +1069,9 @@ export class GameScene extends Phaser.Scene {
|
||||||
this.matchesNeeded = newLevel.matchesNeeded;
|
this.matchesNeeded = newLevel.matchesNeeded;
|
||||||
this.moveInterval = newLevel.moveInterval;
|
this.moveInterval = newLevel.moveInterval;
|
||||||
this.gridColor = newLevel.gridColor;
|
this.gridColor = newLevel.gridColor;
|
||||||
|
if (newLevel.challenge !== undefined) {
|
||||||
|
this.clearAndResetBoard();
|
||||||
|
}
|
||||||
this.LevelText.setText(`Level: ${this.level}`);
|
this.LevelText.setText(`Level: ${this.level}`);
|
||||||
this.sound.play('level-up');
|
this.sound.play('level-up');
|
||||||
this.sound.play('level-complete');
|
this.sound.play('level-complete');
|
||||||
|
|
@ -1124,6 +1127,22 @@ export class GameScene extends Phaser.Scene {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearAndResetBoard() {
|
||||||
|
// Destroy all existing jewels
|
||||||
|
this.jewels.children.iterate((jewel) => {
|
||||||
|
if (jewel) {
|
||||||
|
jewel.destroy();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Clear the jewels group
|
||||||
|
this.jewels.clear(true, true);
|
||||||
|
|
||||||
|
// Bring in 2 fresh rows
|
||||||
|
this.startRows = 2;
|
||||||
|
this.createStart();
|
||||||
|
}
|
||||||
|
|
||||||
// Game over function
|
// Game over function
|
||||||
gameOver() {
|
gameOver() {
|
||||||
console.log('Game Over!');
|
console.log('Game Over!');
|
||||||
|
|
|
||||||
|
|
@ -99,31 +99,31 @@ export const LEVEL_CONFIG = {
|
||||||
numberOfJewels: 7,
|
numberOfJewels: 7,
|
||||||
matchesNeeded: 8,
|
matchesNeeded: 8,
|
||||||
moveInterval: 8000,
|
moveInterval: 8000,
|
||||||
ally: 'bear',
|
ally: 'wizard',
|
||||||
spritePlus: 18,
|
spritePlus: 18,
|
||||||
gridColor: 0xFFFFFF
|
gridColor: 0xFFFFFF
|
||||||
},
|
},
|
||||||
14: {
|
14: {
|
||||||
numberOfJewels: 8,
|
numberOfJewels: 8,
|
||||||
matchesNeeded: 8,
|
matchesNeeded: 8,
|
||||||
moveInterval: 8000,
|
moveInterval: 9000,
|
||||||
ally: 'bear',
|
ally: 'wizard',
|
||||||
spritePlus: 18,
|
spritePlus: 18,
|
||||||
gridColor: 0xFFFFFF
|
gridColor: 0xFFFFFF
|
||||||
},
|
},
|
||||||
15: {
|
15: {
|
||||||
numberOfJewels: 9,
|
numberOfJewels: 9,
|
||||||
matchesNeeded: 8,
|
matchesNeeded: 8,
|
||||||
moveInterval: 8000,
|
moveInterval: 10000,
|
||||||
ally: 'bear',
|
ally: 'wizard',
|
||||||
spritePlus: 18,
|
spritePlus: 18,
|
||||||
gridColor: 0xFFFFFF
|
gridColor: 0xFFFFFF
|
||||||
},
|
},
|
||||||
16: {
|
16: {
|
||||||
numberOfJewels: 10,
|
numberOfJewels: 10,
|
||||||
matchesNeeded: 8,
|
matchesNeeded: 8,
|
||||||
moveInterval: 8000,
|
moveInterval: 11000,
|
||||||
ally: 'bear',
|
ally: 'wizard',
|
||||||
spritePlus: 18,
|
spritePlus: 18,
|
||||||
gridColor: 0xFFFFFF
|
gridColor: 0xFFFFFF
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue