Skip to content

Commit

Permalink
Merge branch 'Team-1--Mobs-Enhancement' of https://github.com/UQcsse3…
Browse files Browse the repository at this point in the history
…200/2023-studio-3 into Team-1--Mobs-Enhancement
  • Loading branch information
JSLLW committed Sep 30, 2023
2 parents 94a0376 + 8261fac commit 1f84438
Show file tree
Hide file tree
Showing 24 changed files with 3,419 additions and 57 deletions.
768 changes: 768 additions & 0 deletions hs_err_pid14780.log

Large diffs are not rendered by default.

765 changes: 765 additions & 0 deletions hs_err_pid22716.log

Large diffs are not rendered by default.

840 changes: 840 additions & 0 deletions hs_err_pid28328.log

Large diffs are not rendered by default.

808 changes: 808 additions & 0 deletions hs_err_pid29160.log

Large diffs are not rendered by default.

Binary file added source/core/assets/sounds/mobBoss/demonAttack.wav
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added source/core/assets/sounds/mobBoss/demonCleave.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/mobBoss/demonDeath.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/mobBoss/demonHeal.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/mobBoss/demonJump.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/mobBoss/demonLand.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/mobBoss/demonSpawn.wav
Binary file not shown.
Binary file added source/core/assets/sounds/mobBoss/slimeJump.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/mobBoss/slimePop.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/mobBoss/slimeySplat.mp3
Binary file not shown.
54 changes: 37 additions & 17 deletions source/core/src/main/com/csse3200/game/areas/ForestGameArea.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,19 @@ public class ForestGameArea extends GameArea {
"sounds/mobs/wizardSpell.mp3",
"sounds/mobs/waterQueenSpell.mp3",
"sounds/mobs/boneBreak.mp3",
"sounds/mobs/fireWormRoar.mp3"
"sounds/mobs/fireWormRoar.mp3",
"sounds/mobBoss/demonBreath.mp3",
"sounds/mobBoss/demonSpawn.wav",
"sounds/mobBoss/demonAttack.wav",
"sounds/mobBoss/demonBreathIn.mp3",
"sounds/mobBoss/demonLand.mp3",
"sounds/mobBoss/demonJump.mp3",
"sounds/mobBoss/demonHeal.mp3",
"sounds/mobBoss/demonCleave.mp3",
"sounds/mobBoss/demonDeath.mp3",
"sounds/mobBoss/slimeySplat.mp3",
"sounds/mobBoss/slimeJump.mp3",
"sounds/mobBoss/slimePop.mp3"
};
private static final String backgroundMusic = "sounds/background/Sci-Fi1.ogg";
private static final String[] forestMusic = {backgroundMusic};
Expand Down Expand Up @@ -232,7 +244,7 @@ private void spawnWave() {
break;
case 4:
spawnFireWorm();
spawnDragonKnight();
// spawnDragonKnight();
logger.info("Lol");
// mobBoss2 = spawnMobBoss2();
break;
Expand Down Expand Up @@ -296,28 +308,36 @@ public void create() {
// spawnSplittingXenoGrunt(15, 4);
// spawnSplittingXenoGrunt(15, 5);
// spawnDodgingDragonKnight(15, 3);
// spawnDemonBoss();
// spawnPatrick();
spawnDemonBoss();
// spawnPatrick();
// spawnIceBaby();
player.getEvents().addListener("spawnWave", this::spawnWave);
playMusic();
startWaveTimer();
spawnScrap();
logger.info("Lol");
// spawnDeflectXenoGrunt(15, 5);
// spawnSplittingXenoGrunt(15, 4);
spawnScrap();
spawnTNTTower();
spawnWeaponTower();
spawnGapScanners();
spawnDroidTower();
// player.getEvents().addListener("spawnWave", this::spawnWave);
// playMusic();
// startWaveTimer();
// spawnScrap();
// logger.info("Lol");
// spawnWaterQueen();
// spawnWaterSlime();
// spawnFireWorm();
// spawnDragonKnight();
// spawnWizard();
// spawnSkeleton();
// spawnIceBaby();
// spawnDemonBoss();
// spawnPatrick();
//
// spawnScrap();
// spawnTNTTower();
// spawnWeaponTower();
// spawnGapScanners();
// spawnDroidTower();
// spawnPatrickDeath();
// spawnFireWorm();

// startWaveTimer();
//// spawnIncome();
// spawnScrap();
spawnTNTTower();
// spawnTNTTower();
//
// spawnGapScanners();
// spawnDroidTower();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,37 @@
package com.csse3200.game.components.bosses;

import com.badlogic.gdx.audio.Sound;
import com.csse3200.game.components.Component;
import com.csse3200.game.rendering.AnimationRenderComponent;
import com.csse3200.game.services.ServiceLocator;

public class DemonAnimationController extends Component {
AnimationRenderComponent animator;
// private static final String DEMON_JUMP = "sounds/mobBoss/demonBreath.mp3";
Sound demonBreath = ServiceLocator.getResourceService().getAsset(
"sounds/mobBoss/demonBreath.mp3", Sound.class);
Sound demonSpawn = ServiceLocator.getResourceService().getAsset(
"sounds/mobBoss/demonSpawn.wav", Sound.class);
Sound demonAttack = ServiceLocator.getResourceService().getAsset(
"sounds/mobBoss/demonAttack.wav", Sound.class);
Sound demonBreathIn = ServiceLocator.getResourceService().getAsset(
"sounds/mobBoss/demonBreathIn.mp3", Sound.class);
Sound demonLand = ServiceLocator.getResourceService().getAsset(
"sounds/mobBoss/demonLand.mp3", Sound.class);
Sound demonRoar = ServiceLocator.getResourceService().getAsset(
"sounds/mobBoss/demonJump.mp3", Sound.class);
Sound demonHeal = ServiceLocator.getResourceService().getAsset(
"sounds/mobBoss/demonHeal.mp3", Sound.class);
Sound demonCleave = ServiceLocator.getResourceService().getAsset(
"sounds/mobBoss/demonCleave.mp3", Sound.class);
Sound demonDeath = ServiceLocator.getResourceService().getAsset(
"sounds/mobBoss/demonDeath.mp3", Sound.class);
Sound slimeySplat = ServiceLocator.getResourceService().getAsset(
"sounds/mobBoss/slimeySplat.mp3", Sound.class);
Sound slimeJump = ServiceLocator.getResourceService().getAsset(
"sounds/mobBoss/slimeJump.mp3", Sound.class);
Sound slimePop = ServiceLocator.getResourceService().getAsset(
"sounds/mobBoss/slimePop.mp3", Sound.class);

/**
* Creation call for a DemonAnimationController, fetches the animationRenderComponent that this controller will
Expand All @@ -14,31 +41,119 @@ public class DemonAnimationController extends Component {
public void create() {
super.create();
animator = entity.getComponent(AnimationRenderComponent.class);
registerAnimationListener("demon_walk");
registerAnimationListener("demon_cleave");
registerAnimationListener("demon_take_hit");
registerAnimationListener("demon_idle");
registerAnimationListener("demon_death");
registerAnimationListener("demon_cast_spell");
registerAnimationListener("demon_fire_breath");
registerAnimationListener("demon_smash");
registerAnimationListener("demon_take_hit");
registerAnimationListener("idle");
registerAnimationListener("move");
registerAnimationListener("projectile_explosion");
registerAnimationListener("projectile_idle");
registerAnimationListener("take_hit");
registerAnimationListener("transform");
registerAnimationListener("transform_reverse");
entity.getEvents().addListener("demon_walk", this::demonWalk);
entity.getEvents().addListener("demon_cleave", this::demonCleave);
entity.getEvents().addListener("demon_idle", this::demonIdle);
entity.getEvents().addListener("demon_death", this::demonDeath);
entity.getEvents().addListener("demon_cast_spell", this::demonCastSpell);
entity.getEvents().addListener("demon_fire_breath", this::demonFireBreath);
entity.getEvents().addListener("demon_smash", this::demonSmash);
entity.getEvents().addListener("demon_take_hit", this::demonTakeHit);
entity.getEvents().addListener("idle", this::idle);
entity.getEvents().addListener("move", this::move);
entity.getEvents().addListener("projectile_explosion", this::projectileExplosion);
entity.getEvents().addListener("projectile_idle", this::projectileIdle);
entity.getEvents().addListener("take_hit", this::takeHit);
entity.getEvents().addListener("transform", this::transform);
entity.getEvents().addListener("demon_spawn_sound", this::demonSpawnSound);
entity.getEvents().addListener("demon_attack_sound", this::demonAttackSound);
entity.getEvents().addListener("demon_breath_in_sound", this::demonBreathInSound);
entity.getEvents().addListener("demon_landing_sound", this::demonLandSound);
entity.getEvents().addListener("demon_roar_sound", this::demonRoarSound);
entity.getEvents().addListener("demon_heal_sound", this::demonHealSound);
entity.getEvents().addListener("demon_cleave_sound", this::demonCleaveSound);
entity.getEvents().addListener("demon_death_sound", this::demonDeathSound);
entity.getEvents().addListener("slimey_splat_sound", this::slimeySplatSound);
entity.getEvents().addListener("slime_jump_sound", this::slimeJumpSound);
entity.getEvents().addListener("slime_pop_sound", this::slimePopSound);
}

private void registerAnimationListener(String animationName) {
if (animationName.equals("transform_reverse")) {
entity.getEvents().addListener(animationName, () ->
animator.startAnimation("transform"));
} else {
entity.getEvents().addListener(animationName, () ->
animator.startAnimation(animationName));
}
private void demonWalk() {
animator.startAnimation("demon_walk");
}
private void demonCleave() {
animator.startAnimation("demon_cleave");
}
private void demonIdle() {
animator.startAnimation("demon_idle");
}
private void demonDeath() {
animator.startAnimation("demon_death");
}
private void demonCastSpell() {
animator.startAnimation("demon_cast_spell");
}
private void demonFireBreath() {
animator.startAnimation("demon_fire_breath");
demonBreath.setVolume(1000,5.5f);
demonBreath.play();
}
private void demonSmash() {
animator.startAnimation("demon_smash");
}
private void demonTakeHit() {
animator.startAnimation("demon_take_hit");
}
private void idle() {
animator.startAnimation("idle");
}
private void move() {
animator.startAnimation("move");
}
private void projectileExplosion() {
animator.startAnimation("projectile_explosion");
}
private void projectileIdle() {
animator.startAnimation("projectile_idle");
}
private void takeHit() {
animator.startAnimation("take_hit");
}
private void transform() {
animator.startAnimation("transform");
}
private void demonSpawnSound() {
demonSpawn.setVolume(1000,5.5f);
demonSpawn.play();
}
private void demonAttackSound() {
demonAttack.setVolume(1000,5.5f);
demonAttack.play();
}
private void demonBreathInSound() {
demonBreathIn.setVolume(1000,5.5f);
demonBreathIn.play();
}
private void demonLandSound() {
demonLand.setVolume(1000,5.5f);
demonLand.play();
}
private void demonRoarSound() {
demonRoar.setVolume(1000,5.5f);
demonRoar.play();
}
private void demonHealSound() {
demonHeal.setVolume(1000,5.5f);
demonHeal.play();
}
private void demonCleaveSound() {
demonCleave.setVolume(1000,5.5f);
demonCleave.play();
}
private void demonDeathSound() {
demonDeath.setVolume(1000,5.5f);
demonDeath.play();
}
private void slimeySplatSound() {
slimeySplat.setVolume(1000,5.5f);
slimeySplat.play();
}
private void slimeJumpSound() {
slimeJump.setVolume(1000,5.5f);
slimeJump.play();
}
private void slimePopSound() {
slimePop.setVolume(1000,5.5f);
slimePop.play();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import com.csse3200.game.ai.tasks.DefaultTask;
import com.csse3200.game.ai.tasks.PriorityTask;
import com.csse3200.game.components.TouchAttackComponent;
import com.csse3200.game.entities.Entity;
import com.csse3200.game.entities.Melee;
import com.csse3200.game.entities.Weapon;
import com.csse3200.game.entities.factories.ProjectileFactory;
import com.csse3200.game.physics.PhysicsEngine;
import com.csse3200.game.physics.PhysicsLayer;
import com.csse3200.game.physics.components.HitboxComponent;
Expand Down Expand Up @@ -98,7 +100,7 @@ public void updateMobState() {
case IDLE -> {
if (isTargetVisible()) {
// targets detected in idle mode - start deployment
// owner.getEntity().getEvents().trigger(DEPLOY);
owner.getEntity().getEvents().trigger(DEPLOY);
mobState = STATE.DEPLOY;
}
}
Expand Down Expand Up @@ -127,10 +129,10 @@ public void updateMobState() {
attackComp.onCollisionStart(hitboxComp.getFixture(), target);
this.owner.getEntity().getEvents().trigger("meleeStart");
} else {
// Entity newProjectile = ProjectileFactory.createMobBall(PhysicsLayer.HUMANS, new Vector2(0, owner.getEntity().getPosition().y), new Vector2(2f,2f));
// newProjectile.setPosition((float) (owner.getEntity().getPosition().x), (float) (owner.getEntity().getPosition().y));
// newProjectile.setScale(-1f, 1f);
// ServiceLocator.getEntityService().register(newProjectile);
Entity newProjectile = ProjectileFactory.createMobBall(PhysicsLayer.HUMANS, new Vector2(0, owner.getEntity().getPosition().y), new Vector2(2f,2f));
newProjectile.setPosition((float) (owner.getEntity().getPosition().x), (float) (owner.getEntity().getPosition().y));
newProjectile.setScale(-1f, 1f);
ServiceLocator.getEntityService().register(newProjectile);

// System.out.printf("ANIMATION: " + owner.getEntity().getComponent(AnimationRenderComponent.class).getCurrentAnimation() + "\n");
this.owner.getEntity().getEvents().trigger(FIRING);
Expand All @@ -144,7 +146,7 @@ public void updateMobState() {
case STOW -> {
// currently stowing
if (isTargetVisible()) {
// owner.getEntity().getEvents().trigger(DEPLOY);
owner.getEntity().getEvents().trigger(DEPLOY);
mobState = STATE.DEPLOY;
} else {
owner.getEntity().getEvents().trigger(IDLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void updateMobState() {
case IDLE -> {
if (isTargetVisible()) {
// targets detected in idle mode - start deployment
// owner.getEntity().getEvents().trigger(DEPLOY);
owner.getEntity().getEvents().trigger(DEPLOY);
mobState = STATE.DEPLOY;
}
}
Expand Down Expand Up @@ -146,7 +146,7 @@ public void updateMobState() {
case STOW -> {
// currently stowing
if (isTargetVisible()) {
// owner.getEntity().getEvents().trigger(DEPLOY);
owner.getEntity().getEvents().trigger(DEPLOY);
mobState = STATE.DEPLOY;
} else {
owner.getEntity().getEvents().trigger(IDLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void updateMobState() {
case IDLE -> {
if (isTargetVisible()) {
// targets detected in idle mode - start deployment
// owner.getEntity().getEvents().trigger(DEPLOY);
owner.getEntity().getEvents().trigger(DEPLOY);
mobState = STATE.DEPLOY;
}
}
Expand All @@ -127,7 +127,6 @@ public void updateMobState() {
TouchAttackComponent attackComp = owner.getEntity().getComponent(TouchAttackComponent.class);
HitboxComponent hitboxComp = owner.getEntity().getComponent(HitboxComponent.class);
attackComp.onCollisionStart(hitboxComp.getFixture(), target);
this.owner.getEntity().getEvents().trigger("shootStart");
Entity newProjectile = ProjectileFactory.createMobBall(PhysicsLayer.HUMANS, new Vector2(0, owner.getEntity().getPosition().y), new Vector2(2f,2f));
newProjectile.setPosition((float) (owner.getEntity().getPosition().x), (float) (owner.getEntity().getPosition().y));
newProjectile.setScale(-1f, 1f);
Expand All @@ -153,7 +152,7 @@ public void updateMobState() {
case STOW -> {
// currently stowing
if (isTargetVisible()) {
// owner.getEntity().getEvents().trigger(DEPLOY);
owner.getEntity().getEvents().trigger(DEPLOY);
mobState = STATE.DEPLOY;
} else {
owner.getEntity().getEvents().trigger(IDLE);
Expand Down
Loading

0 comments on commit 1f84438

Please sign in to comment.