diff --git a/source/core/assets/sounds/towers/12-Gauge-Pump-Action-Shotgun-Close-Gunshot.mp3 b/source/core/assets/sounds/towers/12-Gauge-Pump-Action-Shotgun-Close-Gunshot.mp3 new file mode 100644 index 000000000..61bc03e66 Binary files /dev/null and b/source/core/assets/sounds/towers/12-Gauge-Pump-Action-Shotgun-Close-Gunshot.mp3 differ diff --git a/source/core/assets/sounds/towers/5.56_single_shot.mp3 b/source/core/assets/sounds/towers/5.56_single_shot.mp3 new file mode 100644 index 000000000..0611f722a Binary files /dev/null and b/source/core/assets/sounds/towers/5.56_single_shot.mp3 differ diff --git a/source/core/assets/sounds/towers/Desert-Eagle-Far-Single-Gunshot.mp3 b/source/core/assets/sounds/towers/Desert-Eagle-Far-Single-Gunshot.mp3 new file mode 100644 index 000000000..5e39881ce Binary files /dev/null and b/source/core/assets/sounds/towers/Desert-Eagle-Far-Single-Gunshot.mp3 differ diff --git a/source/core/assets/sounds/towers/ar15_single_shot_far.mp3 b/source/core/assets/sounds/towers/ar15_single_shot_far.mp3 new file mode 100644 index 000000000..34ef353ee Binary files /dev/null and b/source/core/assets/sounds/towers/ar15_single_shot_far.mp3 differ diff --git a/source/core/assets/sounds/towers/eco_tower_ping.mp3 b/source/core/assets/sounds/towers/eco_tower_ping.mp3 new file mode 100644 index 000000000..1553f6001 Binary files /dev/null and b/source/core/assets/sounds/towers/eco_tower_ping.mp3 differ diff --git a/source/core/assets/sounds/towers/explosion.mp3 b/source/core/assets/sounds/towers/explosion.mp3 new file mode 100644 index 000000000..ab19a2947 Binary files /dev/null and b/source/core/assets/sounds/towers/explosion.mp3 differ diff --git a/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java b/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java index b2a09b058..26c3f3ee1 100644 --- a/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java +++ b/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java @@ -202,10 +202,14 @@ public class ForestGameArea extends GameArea { "sounds/mobBoss/patrickThunder.mp3", "sounds/mobBoss/patrickHit.mp3", "sounds/mobBoss/spawnDemonSlime.mp3", + "sounds/towers/Desert-Eagle-Far-Single-Gunshot.mp3", + "sounds/towers/5.56_single_shot.mp3", + "sounds/towers/explosion.mp3", + "sounds/towers/eco_tower_ping.mp3", + "sounds/towers/ar15_single_shot_far.mp3", "sounds/mobs/skeletonHit.mp3", "sounds/mobs/coatAttack.mp3", "sounds/mobs/archerArrow.mp3" - }; private static final String BACKGROUND_MUSIC = "sounds/background/Sci-Fi1.ogg"; @@ -244,6 +248,37 @@ private void stopWaveTimer() { } } + /** + * Cases to spawn a wave + */ +// private void spawnWave() { +// wave++; +// switch (wave) { +// case 1: +// case 2: +// spawnFireWorm(); +// spawnDragonKnight(); +// +// break; +// case 3: +// spawnSkeleton(); +// spawnWizard(); +// // mobBoss2 = spawnMobBoss2(); +// break; +// case 4: +// spawnWaterQueen(); +// spawnWaterSlime(); +// // mobBoss2 = spawnMobBoss2(); +// +// break; +// case 5: +// spawnDemonBoss(); +// default: +// // Handle other wave scenarios if needed +// break; +// } +// } + /** * Create the game area, including terrain, static entities (trees), dynamic entities (player) */ @@ -268,9 +303,10 @@ public void create() { spawnScrap(); spawnGapScanners(); } - + private void displayUI() { Entity ui = new Entity(); +// ui.addComponent(new GameAreaDisplay("Box Forest")); TODO: This should be the level name? ui.addComponent(ServiceLocator.getGameEndService().getDisplay()); ui.addComponent(ServiceLocator.getCurrencyService().getDisplay()); spawnEntity(ui); @@ -333,6 +369,9 @@ private void spawnTerrain() { public void spawnMob(String entity, GridPoint2 randomPos, int health) { Entity mob; switch (entity) { + case "Xeno": + mob = NPCFactory.createXenoGrunt(health); + break; case "SplittingWaterSlime": mob = NPCFactory.createSplittingWaterSlime(health); break; @@ -357,6 +396,7 @@ public void spawnMob(String entity, GridPoint2 randomPos, int health) { case "IceBoss": mob = MobBossFactory.createIceBoss(health); break; + case "Coat": mob = NPCFactory.createCoat(health); break; @@ -369,15 +409,7 @@ public void spawnMob(String entity, GridPoint2 randomPos, int health) { case "ArcaneArcher": mob = NPCFactory.createDodgingArcaneArcher(health); break; - case "SplittingRocky": - mob = NPCFactory.createSplittingRocky(health); - break; - case "Necromancer": - mob = NPCFactory.createNecromancer(health); - break; - case "DeflectFireWizard": - mob = NPCFactory.createDeflectFireWizard(health); - break; + case "PatrickBoss": mob = MobBossFactory.createPatrickBoss(health); break; @@ -395,6 +427,7 @@ public void spawnMob(String entity, GridPoint2 randomPos, int health) { spawnEntityAt(mob, randomPos, true, false); } + private void loadAssets() { logger.debug("Loading assets"); ResourceService resourceService = ServiceLocator.getResourceService(); diff --git a/source/core/src/main/com/csse3200/game/components/tower/DroidAnimationController.java b/source/core/src/main/com/csse3200/game/components/tower/DroidAnimationController.java index efd00a117..8ed009a12 100644 --- a/source/core/src/main/com/csse3200/game/components/tower/DroidAnimationController.java +++ b/source/core/src/main/com/csse3200/game/components/tower/DroidAnimationController.java @@ -1,5 +1,6 @@ package com.csse3200.game.components.tower; +import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.math.Vector2; import com.csse3200.game.components.Component; import com.csse3200.game.components.ProjectileEffects; @@ -16,6 +17,11 @@ public class DroidAnimationController extends Component { private AnimationRenderComponent animator; + private static final String FIRE_SINGLE_SFX = "sounds/towers/5.56_single_shot.mp3"; + + private final Sound fireSingleSound = ServiceLocator.getResourceService().getAsset( + FIRE_SINGLE_SFX, Sound.class); + /** * Creation call for a DroidAnimationController, fetches the animationRenderComponent that this controller will * be attached to and registers all the event listeners required to trigger the animations and sounds. @@ -66,6 +72,7 @@ void animateGoDown() { */ void animateAttackUp() { animator.startAnimation("attackUp"); + fireSingleSound.play(); } /** @@ -74,6 +81,7 @@ void animateAttackUp() { */ void animateAttackDown() { animator.startAnimation("attackDown"); + fireSingleSound.play(); } /** diff --git a/source/core/src/main/com/csse3200/game/components/tower/EconTowerAnimationController.java b/source/core/src/main/com/csse3200/game/components/tower/EconTowerAnimationController.java index 3fcd566f5..3e9a3a785 100644 --- a/source/core/src/main/com/csse3200/game/components/tower/EconTowerAnimationController.java +++ b/source/core/src/main/com/csse3200/game/components/tower/EconTowerAnimationController.java @@ -1,7 +1,9 @@ package com.csse3200.game.components.tower; +import com.badlogic.gdx.audio.Sound; import com.csse3200.game.components.Component; import com.csse3200.game.rendering.AnimationRenderComponent; +import com.csse3200.game.services.ServiceLocator; /** * Listens for events relevant to a weapon tower state. @@ -15,6 +17,11 @@ public class EconTowerAnimationController extends Component { private static final String ECO_MOVE = "move1"; private static final String ECO_IDLE = "idle"; + private static final String PING = "sounds/towers/eco_tower_ping.mp3"; + + private final Sound ping = ServiceLocator.getResourceService().getAsset( + PING, Sound.class); + AnimationRenderComponent animator; /** @@ -36,7 +43,8 @@ void animateIdle() { animator.startAnimation(ECO_IDLE); } - void animateMove() { animator.startAnimation(ECO_MOVE); } + void animateMove() { animator.startAnimation(ECO_MOVE); + ping.play();} } \ No newline at end of file diff --git a/source/core/src/main/com/csse3200/game/components/tower/FireTowerAnimationController.java b/source/core/src/main/com/csse3200/game/components/tower/FireTowerAnimationController.java index 0bfe1fe11..b370365d1 100644 --- a/source/core/src/main/com/csse3200/game/components/tower/FireTowerAnimationController.java +++ b/source/core/src/main/com/csse3200/game/components/tower/FireTowerAnimationController.java @@ -23,6 +23,11 @@ public class FireTowerAnimationController extends Component{ private static final String DEATH_ANIM = "death"; //here we can add the sounds for the implemented animations + private static final String FIRE_SINGLE_SFX = "sounds/towers/Desert-Eagle-Far-Single-Gunshot.mp3"; + + private final Sound fireSingleSound = ServiceLocator.getResourceService().getAsset( + FIRE_SINGLE_SFX, Sound.class); + AnimationRenderComponent animator; /** @@ -57,6 +62,7 @@ void animatePrepAttack() { */ void animateAttack() { animator.startAnimation(ATTACK_ANIM); + fireSingleSound.play(); } void animateDeath() { diff --git a/source/core/src/main/com/csse3200/game/components/tower/FireworksTowerAnimationController.java b/source/core/src/main/com/csse3200/game/components/tower/FireworksTowerAnimationController.java index cd701b0db..e9ec5c653 100644 --- a/source/core/src/main/com/csse3200/game/components/tower/FireworksTowerAnimationController.java +++ b/source/core/src/main/com/csse3200/game/components/tower/FireworksTowerAnimationController.java @@ -1,7 +1,9 @@ package com.csse3200.game.components.tower; +import com.badlogic.gdx.audio.Sound; import com.csse3200.game.components.Component; import com.csse3200.game.rendering.AnimationRenderComponent; +import com.csse3200.game.services.ServiceLocator; /** * This class listens to events relevant to DroidTower entity's state and plays the animation when one @@ -10,6 +12,11 @@ public class FireworksTowerAnimationController extends Component { private AnimationRenderComponent animator; + private static final String FIRE_SINGLE_SFX = "sounds/towers/5.56_single_shot.mp3"; + + private final Sound fireSingleSound = ServiceLocator.getResourceService().getAsset( + FIRE_SINGLE_SFX, Sound.class); + /** * Creation call for a DroidAnimationController, fetches the animationRenderComponent that this controller will * be attached to and registers all the event listeners required to trigger the animations and sounds. @@ -30,6 +37,7 @@ public void create() { */ void animateAttack() { animator.startAnimation("Attack"); + fireSingleSound.play(); } diff --git a/source/core/src/main/com/csse3200/game/components/tower/PierceTowerAnimationController.java b/source/core/src/main/com/csse3200/game/components/tower/PierceTowerAnimationController.java index 9daa39acb..f9018e0af 100644 --- a/source/core/src/main/com/csse3200/game/components/tower/PierceTowerAnimationController.java +++ b/source/core/src/main/com/csse3200/game/components/tower/PierceTowerAnimationController.java @@ -1,7 +1,9 @@ package com.csse3200.game.components.tower; +import com.badlogic.gdx.audio.Sound; import com.csse3200.game.components.Component; import com.csse3200.game.rendering.AnimationRenderComponent; +import com.csse3200.game.services.ServiceLocator; /** * Listens to triggers phrases and executes the required animations. @@ -19,7 +21,10 @@ public class PierceTowerAnimationController extends Component { private static final String ALERT_ANIM = "Warning"; //further sounds can be added for the tower attacks/movement + private static final String FIRE_SINGLE_SFX = "sounds/towers/5.56_single_shot.mp3"; + private final Sound fireSingleSound = ServiceLocator.getResourceService().getAsset( + FIRE_SINGLE_SFX, Sound.class); AnimationRenderComponent animator; /** @@ -48,6 +53,7 @@ void animateIdle() { */ void animateAttack() { animator.startAnimation(ATTACK_ANIM); + fireSingleSound.play(); } /** diff --git a/source/core/src/main/com/csse3200/game/components/tower/RicochetTowerAnimationController.java b/source/core/src/main/com/csse3200/game/components/tower/RicochetTowerAnimationController.java index 1a197868b..8210e7d73 100644 --- a/source/core/src/main/com/csse3200/game/components/tower/RicochetTowerAnimationController.java +++ b/source/core/src/main/com/csse3200/game/components/tower/RicochetTowerAnimationController.java @@ -1,13 +1,19 @@ package com.csse3200.game.components.tower; +import com.badlogic.gdx.audio.Sound; import com.csse3200.game.components.Component; import com.csse3200.game.rendering.AnimationRenderComponent; +import com.csse3200.game.services.ServiceLocator; /** * This class listens to events relevant to DroidTower entity's state and plays the animation when one * of the events is triggered. */ public class RicochetTowerAnimationController extends Component { + private static final String FIRE_SINGLE_SFX = "sounds/towers/5.56_single_shot.mp3"; + + private final Sound fireSingleSound = ServiceLocator.getResourceService().getAsset( + FIRE_SINGLE_SFX, Sound.class); private AnimationRenderComponent animator; /** @@ -30,6 +36,7 @@ public void create() { */ void animateAttack() { animator.startAnimation("Attack"); + fireSingleSound.play(); } diff --git a/source/core/src/main/com/csse3200/game/components/tower/StunTowerAnimationController.java b/source/core/src/main/com/csse3200/game/components/tower/StunTowerAnimationController.java index 846d344dd..d3eaec777 100644 --- a/source/core/src/main/com/csse3200/game/components/tower/StunTowerAnimationController.java +++ b/source/core/src/main/com/csse3200/game/components/tower/StunTowerAnimationController.java @@ -20,6 +20,11 @@ public class StunTowerAnimationController extends Component { //further sounds can be added for the tower attacks/movement + private static final String FIRE_SINGLE_SFX = "sounds/towers/ar15_single_shot_far.mp3"; + + private final Sound fireSingleSound = ServiceLocator.getResourceService().getAsset( + FIRE_SINGLE_SFX, Sound.class); + AnimationRenderComponent animator; /** @@ -47,6 +52,7 @@ void animateIdle() { */ void animateAttack() { animator.startAnimation(ATTACK_ANIM); + fireSingleSound.play(); } /** diff --git a/source/core/src/main/com/csse3200/game/components/tower/TNTAnimationController.java b/source/core/src/main/com/csse3200/game/components/tower/TNTAnimationController.java index 1f092dab5..4ebfa2bb8 100644 --- a/source/core/src/main/com/csse3200/game/components/tower/TNTAnimationController.java +++ b/source/core/src/main/com/csse3200/game/components/tower/TNTAnimationController.java @@ -1,7 +1,9 @@ package com.csse3200.game.components.tower; +import com.badlogic.gdx.audio.Sound; import com.csse3200.game.components.Component; import com.csse3200.game.rendering.AnimationRenderComponent; +import com.csse3200.game.services.ServiceLocator; /** * This class listens to events relevant to TNTTower entity's state and plays the animation when one @@ -9,6 +11,10 @@ */ public class TNTAnimationController extends Component { private AnimationRenderComponent animator; + private static final String EXPLOSION = "sounds/towers/explosion.mp3"; + + private final Sound explosion = ServiceLocator.getResourceService().getAsset( + EXPLOSION, Sound.class); /** * Creation call for a TNTAnimationController, fetches the animationRenderComponent that this controller will @@ -43,7 +49,7 @@ void animateDig() { * This method should be invoked when the entity enters the explosion state. */ void animateExplode() { animator.startAnimation("explode"); - + explosion.play(); } } diff --git a/source/core/src/test/com/csse3200/game/components/tower/DroidAnimationControllerTest.java b/source/core/src/test/com/csse3200/game/components/tower/DroidAnimationControllerTest.java index bbae63278..a752a20c0 100644 --- a/source/core/src/test/com/csse3200/game/components/tower/DroidAnimationControllerTest.java +++ b/source/core/src/test/com/csse3200/game/components/tower/DroidAnimationControllerTest.java @@ -23,6 +23,10 @@ public class DroidAnimationControllerTest { private final String[] texture = {"images/towers/DroidTower.png"}; private final String[] atlas = {"images/towers/DroidTower.atlas"}; + private static final String[] sounds = { + "sounds/towers/5.56_single_shot.mp3" + }; + @BeforeEach public void setUp() { ServiceLocator.registerPhysicsService(new PhysicsService()); @@ -33,6 +37,7 @@ public void setUp() { ServiceLocator.registerResourceService(resourceService); resourceService.loadTextures(texture); resourceService.loadTextureAtlases(atlas); + resourceService.loadSounds(sounds); resourceService.loadAll(); mockEntity = TowerFactory.createDroidTower(); // Replace with actual Droid Tower creation logic diff --git a/source/core/src/test/com/csse3200/game/components/tower/FireTowerAnimationControllerTest.java b/source/core/src/test/com/csse3200/game/components/tower/FireTowerAnimationControllerTest.java index f6d91ddd3..c8187529b 100644 --- a/source/core/src/test/com/csse3200/game/components/tower/FireTowerAnimationControllerTest.java +++ b/source/core/src/test/com/csse3200/game/components/tower/FireTowerAnimationControllerTest.java @@ -23,6 +23,10 @@ public class FireTowerAnimationControllerTest { private final String[] texture = {"images/towers/fire_tower_atlas.png"}; private final String[] atlas = {"images/towers/fire_tower_atlas.atlas"}; + private static final String[] sounds = { + "sounds/towers/Desert-Eagle-Far-Single-Gunshot.mp3" + }; + @BeforeEach public void setUp() { ServiceLocator.registerPhysicsService(new PhysicsService()); @@ -33,6 +37,7 @@ public void setUp() { ServiceLocator.registerResourceService(resourceService); resourceService.loadTextures(texture); resourceService.loadTextureAtlases(atlas); + resourceService.loadSounds(sounds); resourceService.loadAll(); mockEntity = TowerFactory.createFireTower(); // Replace with actual Droid Tower creation logic diff --git a/source/core/src/test/com/csse3200/game/components/tower/StunTowerAnimationControllerTest.java b/source/core/src/test/com/csse3200/game/components/tower/StunTowerAnimationControllerTest.java index 478fd7314..7e5c272ba 100644 --- a/source/core/src/test/com/csse3200/game/components/tower/StunTowerAnimationControllerTest.java +++ b/source/core/src/test/com/csse3200/game/components/tower/StunTowerAnimationControllerTest.java @@ -22,6 +22,9 @@ public class StunTowerAnimationControllerTest { private Entity mockEntity; private final String[] texture = {"images/towers/stun_tower.png"}; private final String[] atlas = {"images/towers/stun_tower.atlas"}; + private static final String[] sounds = { + "sounds/towers/ar15_single_shot_far.mp3" + }; @BeforeEach public void setUp() { @@ -33,6 +36,7 @@ public void setUp() { ServiceLocator.registerResourceService(resourceService); resourceService.loadTextures(texture); resourceService.loadTextureAtlases(atlas); + resourceService.loadSounds(sounds); resourceService.loadAll(); mockEntity = TowerFactory.createStunTower(); // Replace with actual Droid Tower creation logic diff --git a/source/core/src/test/com/csse3200/game/components/tower/TNTAnimationControllerTest.java b/source/core/src/test/com/csse3200/game/components/tower/TNTAnimationControllerTest.java index d72dd437e..a76f4ad18 100644 --- a/source/core/src/test/com/csse3200/game/components/tower/TNTAnimationControllerTest.java +++ b/source/core/src/test/com/csse3200/game/components/tower/TNTAnimationControllerTest.java @@ -25,6 +25,10 @@ public class TNTAnimationControllerTest { private final String[] texture = {"images/towers/TNTTower.png"}; private final String[] atlas = {"images/towers/TNTTower.atlas"}; + private static final String[] sounds = { + "sounds/towers/explosion.mp3" + }; + @BeforeEach public void setUp() { @@ -37,6 +41,7 @@ public void setUp() { ServiceLocator.registerResourceService(resourceService); resourceService.loadTextures(texture); resourceService.loadTextureAtlases(atlas); + resourceService.loadSounds(sounds); resourceService.loadAll(); mockEntity = TowerFactory.createTNTTower(); diff --git a/source/core/src/test/com/csse3200/game/entities/factories/TowerFactoryTest.java b/source/core/src/test/com/csse3200/game/entities/factories/TowerFactoryTest.java index e3d20b53a..01462c0f1 100644 --- a/source/core/src/test/com/csse3200/game/entities/factories/TowerFactoryTest.java +++ b/source/core/src/test/com/csse3200/game/entities/factories/TowerFactoryTest.java @@ -55,7 +55,13 @@ public class TowerFactoryTest { private static final String[] sounds = { "sounds/towers/gun_shot_trimmed.mp3", "sounds/towers/deploy.mp3", - "sounds/towers/stow.mp3" + "sounds/towers/stow.mp3", + "sounds/towers/Desert-Eagle-Far-Single-Gunshot.mp3", + "sounds/towers/5.56_single_shot.mp3", + "sounds/towers/explosion.mp3", + "sounds/towers/eco_tower_ping.mp3", + "sounds/towers/ar15_single_shot_far.mp3" + }; @BeforeEach