Final Release

This commit is contained in:
ExeVirus 2024-02-29 22:57:36 -05:00
parent f1d240b7f6
commit 2e44f732a8
11 changed files with 23 additions and 13 deletions

BIN
docs/assets/GameMusic.mp3 Normal file

Binary file not shown.

Binary file not shown.

2
docs/bundle.min.js vendored

File diff suppressed because one or more lines are too long

BIN
public/assets/GameMusic.mp3 Normal file

Binary file not shown.

Binary file not shown.

View File

@ -45,7 +45,7 @@ export class Enemy extends Phaser.GameObjects.Sprite
if(this.healthBar != null) {
this.healthBar.destroy();
}
if('scene' in this && 'kingdomManager' in this.scene) {
if(this.scene != undefined) {
this.scene.kingdomManager.removeEnemy(this);
}
super.destroy()

View File

@ -23,7 +23,7 @@ export class KingdomManager extends Phaser.GameObjects.Container
this.y = y;
this.width = width;
this.height = height;
this.resource = 975;
this.resource = 230;
this.targetIdx = 0;
this.target = this.getTarget().c;
this.background = scene.add.nineslice(x, y, 'kBack', '', width, height, 25, 25, 25, 25);
@ -46,6 +46,11 @@ export class KingdomManager extends Phaser.GameObjects.Container
enableInput()
{
this.scene.input.keyboard.on('keydown', event => {
if(constants.esc.includes(event.keyCode)) {
this.scene.scene.start('MainMenu');
}
});
this.scene.input.keyboard.on('keydown', event => {
if(constants.spacebar.includes(event.keyCode)) {
this.tryBuild();
@ -133,7 +138,7 @@ export class KingdomManager extends Phaser.GameObjects.Container
let enemy = this.enemyList[i];
const distX = Math.abs(enemy.x - keyButton.x);
const distY = Math.abs(enemy.y - keyButton.y);
if(distX < 110 && distY < 110) {
if(distX < 125 && distY < 110) {
enemy.curHealth -= 60;
if(enemy.curHealth / enemy.startHealth < 0.03) {
enemy.destroy();

View File

@ -46,6 +46,7 @@ for (let i = 0; i < keyNames.length; i++) {
}
const spacebar = keyboard.getLocale().getKeyCodes('space');
const esc = keyboard.getLocale().getKeyCodes('escape');
const gameProgression = [
@ -333,5 +334,6 @@ export const constants = {
rowStartNum,
gameProgression,
spacebar,
esc,
Rounds
};

View File

@ -15,8 +15,8 @@ export class AssetLoader extends Scene
this.load.bitmapFont('sono', 'assets/sono.png', 'assets/sono.xml');
//------------------------ Music ------------------------
this.load.audio('GameMusic', 'assets/music.mp3');
this.load.audio('MainMenuMusic', 'assets/music.mp3');
this.load.audio('GameMusic', 'assets/GameMusic.mp3');
this.load.audio('MainMenuMusic', 'assets/MainMenuMusic.mp3');
//-------------------- Sound Effects --------------------

View File

@ -1,7 +1,6 @@
import { constants } from '../key_classes/constants.js';
import { Scene } from 'phaser';
import { KeyButton } from '../key_classes/KeyButton.js';
import { Enemy } from '../key_classes/Enemy.js';
import { KingdomManager } from '../key_classes/KingdomManager.js';
import { Castle } from '../buildings/Castle.js';
import { RoundManager } from '../key_classes/RoundManager.js';
@ -23,9 +22,9 @@ export class Game extends Scene
create ()
{
const music = this.sound.add('GameMusic');
music.play();
music.loop = true;
this.music = this.sound.add('GameMusic');
this.music.play();
this.music.loop = true;
this.kingdomManager = new KingdomManager(this, 1920/2, 910, 1600, 230);
this.roundManager = new RoundManager(this, 160, 200, 1600, 40);
this.keyButtons = []
@ -51,6 +50,8 @@ export class Game extends Scene
shutdown ()
{
this.music.stop();
this.music.destroy();
this.input.keyboard.shutdown();
}

View File

@ -32,9 +32,9 @@ export class MainMenu extends Scene
}
}
}
const music = this.sound.add('MainMenuMusic');
music.play();
music.loop = true;
this.music = this.sound.add('MainMenuMusic');
this.music.play();
this.music.loop = true;
}
update(time, delta)
@ -45,6 +45,8 @@ export class MainMenu extends Scene
shutdown ()
{
this.music.stop();
this.music.destroy();
this.input.keyboard.shutdown();
}
}