Added Surfer Guy

This commit is contained in:
Brian Fertig 2025-08-24 13:00:05 -06:00
parent d4beae5984
commit 28779c3269
19 changed files with 145 additions and 82 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

BIN
assets/surfer-a1.mp3 Normal file

Binary file not shown.

BIN
assets/surfer-a2.mp3 Normal file

Binary file not shown.

BIN
assets/surfer-a3.mp3 Normal file

Binary file not shown.

BIN
assets/surfer-b.mp3 Normal file

Binary file not shown.

Binary file not shown.

BIN
assets/surfer-c.mp3 Normal file

Binary file not shown.

BIN
assets/surfer-excited.mp4 Normal file

Binary file not shown.

BIN
assets/surfer-intro.mp3 Normal file

Binary file not shown.

BIN
assets/surfer-match.mp4 Normal file

Binary file not shown.

BIN
assets/surfer-music.mp3 Normal file

Binary file not shown.

BIN
assets/surfer-music2.mp3 Normal file

Binary file not shown.

BIN
assets/surfer-outro.mp3 Normal file

Binary file not shown.

BIN
assets/surfer-pleased.mp4 Normal file

Binary file not shown.

BIN
assets/surfer-resting.mp4 Normal file

Binary file not shown.

BIN
assets/surferDude.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

View File

@ -20,7 +20,7 @@ export class GameScene extends Phaser.Scene {
this.matchesNeeded = 8;
this.score = 0;
this.ally = 'goblin';
this.gameStatus = true;
this.spritePlus = 0;
// Status Indication
this.isDropping = false;
@ -29,6 +29,7 @@ export class GameScene extends Phaser.Scene {
this.isMovingUp = false;
this.isPlayingVideo = false;
this.isPlayingAudio = false;
this.gameStatus = true;
// Add selectedJewel property
this.selectedJewel = null;
@ -53,8 +54,6 @@ export class GameScene extends Phaser.Scene {
this.load.font('code', 'assets/CodePredators-Regular.otf');
// Music
this.load.audio('goblin-music', 'assets/goblin-music.mp3');
this.load.audio('beach-music', 'assets/beach-music.mp3');
this.load.audio('clear', 'assets/clear.mp3');
this.load.audio('level-up', 'assets/level-up.mp3');
this.load.audio('switch', 'assets/switch.mp3');
@ -63,20 +62,21 @@ export class GameScene extends Phaser.Scene {
this.load.audio('alarm', 'assets/alarm.mp3');
// Ally Assets
const allys = ['goblin'];
const allys = ['goblin', 'surfer'];
allys.forEach((ally) => {
this.load.video(`${ally}-resting`, 'assets/goblin-resting.mp4');
this.load.video(`${ally}-excited`, 'assets/goblin-excited.mp4');
this.load.video(`${ally}-pleased`, 'assets/goblin-pleased.mp4');
this.load.video(`${ally}-match`, 'assets/goblin-match.mp4');
this.load.video(`${ally}-resting`, `assets/${ally}-resting.mp4`);
this.load.video(`${ally}-excited`, `assets/${ally}-excited.mp4`);
this.load.video(`${ally}-pleased`, `assets/${ally}-pleased.mp4`);
this.load.video(`${ally}-match`, `assets/${ally}-match.mp4`);
this.load.video(`${ally}-background`, `assets/${ally}-background.mp4`);
this.load.audio(`${ally}-a1`, 'assets/goblin-a1.mp3');
this.load.audio(`${ally}-a2`, 'assets/goblin-a2.mp3');
this.load.audio(`${ally}-a3`, 'assets/goblin-a3.mp3');
this.load.audio(`${ally}-b`, 'assets/goblin-b.mp3');
this.load.audio(`${ally}-c`, 'assets/goblin-c.mp3');
this.load.audio(`${ally}-intro`, 'assets/goblin-intro.mp3');
this.load.audio(`${ally}-outro`, 'assets/goblin-outro.mp3');
this.load.audio(`${ally}-a1`, `assets/${ally}-a1.mp3`);
this.load.audio(`${ally}-a2`, `assets/${ally}-a2.mp3`);
this.load.audio(`${ally}-a3`, `assets/${ally}-a3.mp3`);
this.load.audio(`${ally}-b`, `assets/${ally}-b.mp3`);
this.load.audio(`${ally}-c`, `assets/${ally}-c.mp3`);
this.load.audio(`${ally}-intro`, `assets/${ally}-intro.mp3`);
this.load.audio(`${ally}-outro`, `assets/${ally}-outro.mp3`);
this.load.audio(`${ally}-music`, `assets/${ally}-music.mp3`);
});
}
@ -229,7 +229,7 @@ export class GameScene extends Phaser.Scene {
col * this.gridConfig.jewelWidth + this.gridConfig.leftPadding,
row * this.gridConfig.jewelHeight,
'jewels',
type
type + this.spritePlus
);
jewel.setOrigin(0.5);
jewel.setDisplaySize(this.gridConfig.jewelWidth, this.gridConfig.jewelHeight);
@ -544,53 +544,6 @@ export class GameScene extends Phaser.Scene {
this.matchesText.setText(`Matches Needed: ${this.matchesNeeded}`);
}
levelUp() {
this.level ++;
const newLevel = LEVEL_CONFIG[this.level];
this.numberOfJewels = newLevel.numberOfJewels;
this.matchesNeeded = newLevel.matchesNeeded;
this.moveInterval = newLevel.moveInterval;
this.LevelText.setText(`Level: ${this.level}`);
this.sound.play('level-up');
// Create the New Level text
const newLevelText = this.add.text(1150, 250, `Level ${this.level}`, {
fontFamily: 'code, arial',
fontSize: '100px',
fill: '#ea00ffff',
padding: {
left: 10,
right: 10,
top: 5,
bottom: 5
}
}).setOrigin(0.5);
// Add cool eye-catching effect
this.tweens.add({
targets: newLevelText,
scale: { from: 0.5, to: 1.5 },
alpha: { from: 0, to: 1 },
duration: 1000,
ease: 'Back.easeOut',
yoyo: true
});
// Fade out and destroy after 500ms
this.time.delayedCall(1200, () => {
this.tweens.add({
targets: newLevelText,
angle: 360,
scale: 0,
alpha: 0,
duration: 500,
onComplete: () => {
newLevelText.destroy();
}
});
});
}
// Function to check for matches and destroy them
checkMatches() {
const matchedJewels = new Set();
@ -1006,6 +959,108 @@ export class GameScene extends Phaser.Scene {
}
}
refreshJewelSprites() {
// Iterate through all jewels and update their sprite frames
this.jewels.children.iterate((jewel) => {
if (jewel && jewel.jewelType !== undefined) {
// Update the jewel's frame to reflect the new spritePlus value
jewel.setFrame(jewel.jewelType + this.spritePlus);
}
});
}
refreshScene(originalAlly) {
// Stop the current music
this.bgMusic.stop();
// Play the new ally's music
this.bgMusic = this.sound.add(`${this.ally}-music`, { volume: 0.2 });
this.bgMusic.loop = true;
this.bgMusic.play();
// Refresh the ally video with the new ally
if (this.allyVideo) {
console.log('update-vid ',this.ally);
// Destroy the existing video
this.allyVideo.destroy();
// Create a new video with the updated ally
this.allyVideo = this.add.video(350, 610, `${this.ally}-resting`).setOrigin(0.5);
this.allyVideo.play(true);
this.allyVideo.postFX.addGlow();
}
// Refresh the background video with the new ally
if (this.bgVideo) {
// Destroy the existing background video
this.bgVideo.destroy();
// Create a new background video with the updated ally
this.bgVideo = this.add.video(0, 0, `${this.ally}-background`).setOrigin(0);
this.bgVideo.scaleX = this.scale.width / 848;
this.bgVideo.scaleY = this.scale.height / 480;
this.bgVideo.play(true).setDepth(-1);
}
}
levelUp() {
this.level ++;
const newLevel = LEVEL_CONFIG[this.level];
this.numberOfJewels = newLevel.numberOfJewels;
this.matchesNeeded = newLevel.matchesNeeded;
this.moveInterval = newLevel.moveInterval;
this.LevelText.setText(`Level: ${this.level}`);
this.sound.play('level-up');
if (this.ally !== newLevel.ally) {
this.sound.play(`${this.ally}-outro`);
this.time.delayedCall(1000, () => {
const originalAlly = this.ally;
this.ally = newLevel.ally;
this.refreshScene(originalAlly);
this.spritePlus = newLevel.spritePlus;
this.refreshJewelSprites();
});
}
// Create the New Level text
const newLevelText = this.add.text(1150, 250, `Level ${this.level}`, {
fontFamily: 'code, arial',
fontSize: '100px',
fill: '#ea00ffff',
padding: {
left: 10,
right: 10,
top: 5,
bottom: 5
}
}).setOrigin(0.5);
// Add cool eye-catching effect
this.tweens.add({
targets: newLevelText,
scale: { from: 0.5, to: 1.5 },
alpha: { from: 0, to: 1 },
duration: 1000,
ease: 'Back.easeOut',
yoyo: true
});
// Fade out and destroy after 500ms
this.time.delayedCall(1200, () => {
this.tweens.add({
targets: newLevelText,
angle: 360,
scale: 0,
alpha: 0,
duration: 500,
onComplete: () => {
newLevelText.destroy();
}
});
});
}
// Game over function
gameOver() {
console.log('Game Over!');

View File

@ -3,48 +3,56 @@ export const LEVEL_CONFIG = {
numberOfJewels: 4,
matchesNeeded: 8,
moveInterval: 12000,
ally: 'goblin'
ally: 'goblin',
spritePlus: 0
},
2: {
numberOfJewels: 5,
matchesNeeded: 8,
moveInterval: 12000,
ally: 'goblin'
ally: 'goblin',
spritePlus: 0
},
3: {
numberOfJewels: 5,
matchesNeeded: 9,
moveInterval: 11000,
ally: 'goblin'
ally: 'goblin',
spritePlus: 0
},
4: {
numberOfJewels: 5,
matchesNeeded: 10,
moveInterval: 10000,
ally: 'goblin'
ally: 'goblin',
spritePlus: 0
},
5: {
numberOfJewels: 5,
matchesNeeded: 12,
moveInterval: 9000,
ally: 'goblin'
matchesNeeded: 10,
moveInterval: 10000,
ally: 'surfer',
spritePlus: 10
},
6: {
numberOfJewels: 5,
matchesNeeded: 12,
moveInterval: 8000,
ally: 'goblin'
numberOfJewels: 6,
matchesNeeded: 10,
moveInterval: 10000,
ally: 'surfer',
spritePlus: 10
},
7: {
numberOfJewels: 5,
matchesNeeded: 12,
moveInterval: 7000,
ally: 'goblin'
numberOfJewels: 6,
matchesNeeded: 10,
moveInterval: 9000,
ally: 'surfer',
spritePlus: 10
},
8: {
numberOfJewels: 5,
matchesNeeded: 12,
moveInterval: 6000,
ally: 'goblin'
numberOfJewels: 6,
matchesNeeded: 10,
moveInterval: 8000,
ally: 'surfer',
spritePlus: 10
}
};