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
|
||||
this.numberOfJewels = 4;
|
||||
this.startRows = 5;
|
||||
this.level = 1;
|
||||
this.startRows = 2;
|
||||
this.level = 12;
|
||||
this.matchesNeeded = 8;
|
||||
this.score = 0;
|
||||
this.ally = 'goblin';
|
||||
|
|
@ -65,7 +65,7 @@ export class GameScene extends Phaser.Scene {
|
|||
this.load.audio('alarm', 'assets/alarm.mp3');
|
||||
|
||||
// Ally Assets
|
||||
const allys = ['goblin', 'surfer', 'bear'];
|
||||
const allys = ['goblin', 'surfer', 'bear', 'wizard'];
|
||||
allys.forEach((ally) => {
|
||||
this.load.video(`${ally}-resting`, `assets/${ally}-resting.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.moveInterval = newLevel.moveInterval;
|
||||
this.gridColor = newLevel.gridColor;
|
||||
if (newLevel.challenge !== undefined) {
|
||||
this.clearAndResetBoard();
|
||||
}
|
||||
this.LevelText.setText(`Level: ${this.level}`);
|
||||
this.sound.play('level-up');
|
||||
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
|
||||
gameOver() {
|
||||
console.log('Game Over!');
|
||||
|
|
|
|||
|
|
@ -99,31 +99,31 @@ export const LEVEL_CONFIG = {
|
|||
numberOfJewels: 7,
|
||||
matchesNeeded: 8,
|
||||
moveInterval: 8000,
|
||||
ally: 'bear',
|
||||
ally: 'wizard',
|
||||
spritePlus: 18,
|
||||
gridColor: 0xFFFFFF
|
||||
},
|
||||
14: {
|
||||
numberOfJewels: 8,
|
||||
matchesNeeded: 8,
|
||||
moveInterval: 8000,
|
||||
ally: 'bear',
|
||||
moveInterval: 9000,
|
||||
ally: 'wizard',
|
||||
spritePlus: 18,
|
||||
gridColor: 0xFFFFFF
|
||||
},
|
||||
15: {
|
||||
numberOfJewels: 9,
|
||||
matchesNeeded: 8,
|
||||
moveInterval: 8000,
|
||||
ally: 'bear',
|
||||
moveInterval: 10000,
|
||||
ally: 'wizard',
|
||||
spritePlus: 18,
|
||||
gridColor: 0xFFFFFF
|
||||
},
|
||||
16: {
|
||||
numberOfJewels: 10,
|
||||
matchesNeeded: 8,
|
||||
moveInterval: 8000,
|
||||
ally: 'bear',
|
||||
moveInterval: 11000,
|
||||
ally: 'wizard',
|
||||
spritePlus: 18,
|
||||
gridColor: 0xFFFFFF
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue