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-variations
  • Loading branch information
freshc0w committed Sep 29, 2023
2 parents fced1be + a382120 commit c280568
Show file tree
Hide file tree
Showing 18 changed files with 93 additions and 41 deletions.
Binary file modified source/core/assets/sounds/mobBoss/iceBabyAOE.mp3
Binary file not shown.
Binary file modified source/core/assets/sounds/mobBoss/iceBabySound.mp3
Binary file not shown.
Binary file modified source/core/assets/sounds/mobBoss/mobSpawnStomp.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/mobs/boneBreak.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/mobs/fireWormRoar.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/mobs/fireWormRoar.wav
Binary file not shown.
Binary file not shown.
Binary file added source/core/assets/sounds/mobs/wizardSpell.mp3
Binary file not shown.
42 changes: 24 additions & 18 deletions source/core/src/main/com/csse3200/game/areas/ForestGameArea.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ public class ForestGameArea extends GameArea {
"sounds/projectiles/explosion.mp3",
"sounds/mobBoss/iceBabySound.mp3",
"sounds/mobBoss/mobSpawnStomp.mp3",
"sounds/mobBoss/iceBabyAOE.mp3"
"sounds/mobBoss/iceBabyAOE.mp3",
"sounds/mobs/wizardSpell.mp3",
"sounds/mobs/waterQueenSpell.mp3",
"sounds/mobs/boneBreak.mp3",
"sounds/mobs/fireWormRoar.mp3"
};
private static final String backgroundMusic = "sounds/background/Sci-Fi1.ogg";
private static final String[] forestMusic = {backgroundMusic};
Expand Down Expand Up @@ -217,25 +221,27 @@ private void spawnWave() {
case 2:
spawnWaterQueen();
spawnWaterSlime();
spawnIceBaby();
logger.info("Lol");

break;
case 3:
logger.info("Lol");
spawnWizard();
// spawnDragonKnight();
spawnSkeleton();
spawnIceBaby();
logger.info("Lol");
// mobBoss2 = spawnMobBoss2();
break;
case 4:
logger.info("Lol");
spawnFireWorm();
spawnDragonKnight();
// mobBoss2 = spawnMobBoss2();
break;
logger.info("Lol");
// mobBoss2 = spawnMobBoss2();
break;
case 5:
spawnDemonBoss();
case 6:
spawnWizard();
spawnSkeleton();
case 7:
spawnDemonBoss();
spawnPatrick();
default:
// Handle other wave scenarios if needed
break;
Expand Down Expand Up @@ -275,11 +281,11 @@ public void create() {

// spawnDragonKnight();
// spawnFireWorm(19, 5); // * TEMPORARY for testing
spawnFireTowerTowerAt(3, 1);
spawnFireTowerTowerAt(3, 2);
spawnFireTowerTowerAt(3, 3);
spawnFireTowerTowerAt(3, 4);
spawnFireTowerTowerAt(3, 5);
// spawnFireTowerTowerAt(3, 1);
// spawnFireTowerTowerAt(3, 2);
// spawnFireTowerTowerAt(3, 3);
// spawnFireTowerTowerAt(3, 4);
// spawnFireTowerTowerAt(3, 5);
// spawnDroidTowerAt(3, 1);
// spawnDroidTowerAt(3, 2);
// spawnDroidTowerAt(3, 3);
Expand All @@ -290,9 +296,9 @@ public void create() {
// spawnSplittingXenoGrunt(15, 4);
// spawnSplittingXenoGrunt(15, 5);
// spawnDodgingDragonKnight(15, 3);
spawnDemonBoss();
spawnPatrick();
spawnIceBaby();
// spawnDemonBoss();
// spawnPatrick();
// spawnIceBaby();
player.getEvents().addListener("spawnWave", this::spawnWave);
playMusic();
startWaveTimer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ private void deflectProj(Fixture me, Fixture other) {
// Change target layer of projectile.
projectile.getComponent(TouchAttackComponent.class)
.setTargetLayer(dmgLayer);
entity.getEvents().trigger("shootStart");

// Make sure projectile is not deleted in the next frame.
projectile.setFlagForDelete(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ public class FireWormAnimationController extends Component {
AnimationRenderComponent animator;
private SecureRandom rand = new SecureRandom();

private static final String ATTACK_SOUND = "sounds/mobs/fireWormRoar.mp3";
Sound attackSound = ServiceLocator.getResourceService().getAsset(
ATTACK_SOUND, Sound.class);

@Override
public void create() {
super.create();
Expand All @@ -34,6 +38,7 @@ void animateWalk() {

void animateAttack() {
animator.startAnimation("fire_worm_attack");
attackSound.play();
}

void animateDeath() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public class SkeletonAnimationController extends Component {
AnimationRenderComponent animator;
private SecureRandom rand = new SecureRandom();

/** Sound variables */
private static final String ATTACK_SOUND = "sounds/mobs/boneBreak.mp3";
Sound deathSound = ServiceLocator.getResourceService().getAsset(
ATTACK_SOUND, Sound.class);

@Override
public void create() {
super.create();
Expand All @@ -37,6 +42,7 @@ void animateAttack() {

void animateDeath() {
animator.startAnimation("skeleton_death");
deathSound.play();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ public class WaterQueenAnimationController extends Component {
AnimationRenderComponent animator;
private SecureRandom rand = new SecureRandom();

private static final String ATTACK_SOUND = "sounds/mobs/waterQueenSpell.mp3";
Sound attackSound = ServiceLocator.getResourceService().getAsset(
ATTACK_SOUND, Sound.class);

@Override
public void create() {
super.create();
Expand All @@ -33,6 +37,7 @@ void animateWalk() {

void animateAttack() {
animator.startAnimation("water_queen_attack");
attackSound.play();
}

void animateDeath() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,21 @@ public class WizardAnimationController extends Component {
AnimationRenderComponent animator;
private SecureRandom rand = new SecureRandom();

/** Sound variables */
private static final String ATTACK_SOUND = "sounds/mobs/wizardSpell.mp3";
Sound attackSound = ServiceLocator.getResourceService().getAsset(
ATTACK_SOUND, Sound.class);


@Override
public void create() {
super.create();
animator = this.entity.getComponent(AnimationRenderComponent.class);
entity.getEvents().addListener("wanderStart", this::animateWalk);
entity.getEvents().addListener("shootStart", this::animateAttack);
entity.getEvents().addListener("dieStart", this::animateDeath);


}

void animateWalk() {
Expand All @@ -33,6 +41,7 @@ void animateWalk() {

void animateAttack() {
animator.startAnimation("wizard_attack");
attackSound.play();
}

void animateDeath() {
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import com.csse3200.game.services.GameTime;
import com.csse3200.game.services.ServiceLocator;


/**
* Task that allows mobs to shoot projectiles or melee attack towers
*/
Expand Down Expand Up @@ -124,20 +123,27 @@ public void updateMobState() {
this.owner.getEntity().getEvents().trigger(STOW);
mobState = STATE.STOW;
} else {
if (!(this.meleeOrProjectile() instanceof Melee)) {
if (this.meleeOrProjectile() instanceof Melee) {
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);
ServiceLocator.getEntityService().register(newProjectile);

// System.out.printf("ANIMATION: " + owner.getEntity().getComponent(AnimationRenderComponent.class).getCurrentAnimation() + "\n");
// System.out.printf("ANIMATION: " + owner.getEntity().getComponent(AnimationRenderComponent.class).getCurrentAnimation() + "\n");
this.owner.getEntity().getEvents().trigger(FIRING);
mobState = STATE.STOW;
} else {
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);
ServiceLocator.getEntityService().register(newProjectile);

// System.out.printf("ANIMATION: " + owner.getEntity().getComponent(AnimationRenderComponent.class).getCurrentAnimation() + "\n");
this.owner.getEntity().getEvents().trigger(FIRING);
mobState = STATE.STOW;
}
}
owner.getEntity().getComponent(PhysicsMovementComponent.class).setEnabled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ public static Entity createIceBoss() {
ServiceLocator.getResourceService().getAsset("images/mobboss/iceBaby.atlas", TextureAtlas.class));
animator.addAnimation("idle", 0.2f, Animation.PlayMode.NORMAL);
animator.addAnimation("1_atk", 0.2f, Animation.PlayMode.NORMAL);
animator.addAnimation("2_atk", 0.1f, Animation.PlayMode.NORMAL);
animator.addAnimation("3_atk", 0.1f, Animation.PlayMode.NORMAL);
animator.addAnimation("2_atk", 0.2f, Animation.PlayMode.NORMAL);
animator.addAnimation("3_atk", 0.2f, Animation.PlayMode.NORMAL);
animator.addAnimation("death", 0.2f, Animation.PlayMode.NORMAL);
animator.addAnimation("intro_or_revive", 0.1f, Animation.PlayMode.NORMAL);
animator.addAnimation("intro_or_revive", 0.2f, Animation.PlayMode.NORMAL);
animator.addAnimation("stagger", 0.2f, Animation.PlayMode.NORMAL);
animator.addAnimation("take_hit", 0.2f, Animation.PlayMode.NORMAL);
animator.addAnimation("walk", 0.2f, Animation.PlayMode.NORMAL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public static Entity createWizard() {
return wizard;
}
/**
* Creates a wizard entity.
* Creates a water queen entity.
*
* @return entity
*/
Expand Down Expand Up @@ -200,7 +200,7 @@ public static Entity createWaterQueen() {
return wizard;
}
/**
* Creates a wizard entity.
* Creates a water slime entity.
*
* @return entity
*/
Expand All @@ -217,7 +217,7 @@ public static Entity createBaseWaterSlime() {
ServiceLocator.getResourceService().getAsset("images/mobs/water_slime.atlas", TextureAtlas.class));
animator.addAnimation("water_slime_walk", 0.1f, Animation.PlayMode.LOOP);
animator.addAnimation("water_slime_attack", 0.1f);
animator.addAnimation("water_slime_death", 0.1f);
animator.addAnimation("water_slime_death", 0.2f);
animator.addAnimation("default", 0.1f);
waterSlime
.addComponent(new CombatStatsComponent(config.fullHeath, config.baseAttack, drops, melee, projectiles))
Expand Down Expand Up @@ -335,6 +335,7 @@ public static Entity createMeleeBaseNPC() {
new AITaskComponent()
.addTask(new MobWanderTask(new Vector2(2f, 2f), 2f))
.addTask(new MobMeleeAttackTask(2, 2f));
// .addTask(new MobAttackTask(2, 2f));
// .addTask(new MeleeMobTask(new Vector2(2f, 2f), 2f));

// .addTask(new MobAttackTask(2, 40));
Expand All @@ -358,6 +359,7 @@ public static Entity createRangedBaseNPC() {
AITaskComponent aiComponent =
new AITaskComponent()
.addTask(new MobWanderTask(new Vector2(2f, 2f), 2f))
// .addTask(new MobAttackTask(2, 2f));
.addTask(new MobRangedAttackTask(2, 2f));
// .addTask(new MeleeMobTask(new Vector2(2f, 2f), 2f));

Expand All @@ -378,19 +380,25 @@ private NPCFactory() {
throw new IllegalStateException("Instantiating static util class");
}

// * COW'S TESTING ARENA DONT TOUCH
/**
* Create Splitting water slime
*
* @return
*/
public static Entity createSplittingWaterSlime() {
Entity splitWaterSlime = createBaseWaterSlime()
// add the scaling yourself. can also scale the X and Y component,
// leading to some very interesting mob designs.

.addComponent(new SplitMoblings(7, 0.5f));
// .addComponent(new DodgingComponent(PhysicsLayer.PROJECTILE, 0.25f));


// * TEMPORARY TESTING FOR PROJECTILE DODGING
// splitWaterSlime.getComponent(AITaskComponent.class).addTask(new MobDodgeTask(new Vector2(2f, 2f), 2f, 5));
return splitWaterSlime;
}

/**
* Create a dodging Dragon Knight
*
* @return
*/
public static Entity createDodgingDragonKnight() {
Entity fireWorm = createDragonKnight();

Expand All @@ -400,12 +408,16 @@ public static Entity createDodgingDragonKnight() {
return fireWorm;
}

/**
* Creates a wizard that can deflect bullets
* @return
*/
public static Entity createDeflectWizard() {
Entity deflectXenoGrunt = createWizard();
deflectXenoGrunt.addComponent(new DeflectingComponent(
Entity deflectWizard = createWizard();
deflectWizard.addComponent(new DeflectingComponent(
PhysicsLayer.PROJECTILE, PhysicsLayer.TOWER, 10));

return deflectXenoGrunt;
return deflectWizard;
}
}

Expand Down

0 comments on commit c280568

Please sign in to comment.