From b66e24e4223be40f84fbcb8ee959b141b9a2d8cb Mon Sep 17 00:00:00 2001 From: gregchan550 <86044792+gregchan550@users.noreply.github.com> Date: Mon, 25 Sep 2023 21:23:16 +1000 Subject: [PATCH 01/10] forest game area set up for testing patrick --- .../com/csse3200/game/areas/ForestGameArea.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 fc6b1e7e8..b7519f448 100644 --- a/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java +++ b/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java @@ -251,7 +251,7 @@ public void create() { // Set up infrastructure for end game tracking player = spawnPlayer(); - player.getEvents().addListener("spawnWave", this::spawnWave); + //player.getEvents().addListener("spawnWave", this::spawnWave); //playMusic(); // Types of projectile @@ -273,18 +273,18 @@ public void create() { spawnFireTowerTowerAt(3, 3); spawnFireTowerTowerAt(3, 4); spawnFireTowerTowerAt(3, 5); - spawnDroidTowerAt(3, 1); - spawnDroidTowerAt(3, 2); - spawnDroidTowerAt(3, 3); - spawnDroidTowerAt(3, 4); - spawnDroidTowerAt(3, 5); +// spawnDroidTowerAt(3, 1); +// spawnDroidTowerAt(3, 2); +// spawnDroidTowerAt(3, 3); +// spawnDroidTowerAt(3, 4); +// spawnDroidTowerAt(3, 5); // spawnSplittingXenoGrunt(15, 5); - spawnDeflectXenoGrunt(15, 5); +// spawnDeflectXenoGrunt(15, 5); // spawnSplittingXenoGrunt(15, 4); // spawnSplittingXenoGrunt(15, 5); // spawnDodgingDragonKnight(15, 3); // spawnDemonBoss(); - // spawnPatrickBoss(); + spawnPatrick(); // spawnFireWorm(); //mobBoss1 = spawnMobBoss1(); From ba59652bec17b5cc57674e4f4a39b594f1bc0b02 Mon Sep 17 00:00:00 2001 From: gregchan550 <86044792+gregchan550@users.noreply.github.com> Date: Mon, 25 Sep 2023 22:26:11 +1000 Subject: [PATCH 02/10] created new task and new entity in boss factory to play death animation but game is crashing when boss dies when the task tries to spawn in the entity --- .../csse3200/game/areas/ForestGameArea.java | 4 +- .../tasks/bosstask/DemonBossTask.java | 20 ++++----- .../tasks/bosstask/PatrickDeathTask.java | 35 +++++++++++++++ .../tasks/bosstask/PatrickTask.java | 9 ++++ .../entities/factories/MobBossFactory.java | 43 ++++++++++++++++--- 5 files changed, 92 insertions(+), 19 deletions(-) create mode 100644 source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickDeathTask.java 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 b7519f448..4e4d7417f 100644 --- a/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java +++ b/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java @@ -283,7 +283,7 @@ public void create() { // spawnSplittingXenoGrunt(15, 4); // spawnSplittingXenoGrunt(15, 5); // spawnDodgingDragonKnight(15, 3); - // spawnDemonBoss(); +// spawnDemonBoss(); spawnPatrick(); // spawnFireWorm(); @@ -294,7 +294,7 @@ public void create() { // spawnTNTTower(); // // spawnGapScanners(); - spawnDroidTower(); +// spawnDroidTower(); // // mobBoss2 = spawnMobBoss2(); diff --git a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/DemonBossTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/DemonBossTask.java index 5597fbd08..360cad774 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/DemonBossTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/DemonBossTask.java @@ -38,7 +38,7 @@ public class DemonBossTask extends DefaultTask implements PriorityTask { private static final int Y_BOT_BOUNDARY = 1; private static final int BREATH_ANIM_TIME = 2; private static final int SMASH_RADIUS = 3; - private static final int MOVE_FORWARD_DELAY = 30; + private static final int MOVE_FORWARD_DELAY = 15; private static final float BREATH_DURATION = 4.2f; private static final int SMASH_DAMAGE = 30; private static final int CLEAVE_DAMAGE = 50; @@ -56,7 +56,7 @@ public class DemonBossTask extends DefaultTask implements PriorityTask { private DemonState prevState; private AnimationRenderComponent animation; private Entity demon; - private int numBalls = 6; + private int numBalls = 3; private static int xRightBoundary = 17; private static int xLeftBoundary = 12; private ProjectileEffects effect = ProjectileEffects.BURN; @@ -72,9 +72,7 @@ public class DemonBossTask extends DefaultTask implements PriorityTask { * The different demon states. */ private enum DemonState { - TRANSFORM, IDLE, CAST, CLEAVE, DEATH, BREATH, SMASH, TAKE_HIT, - WALK, TRANSFORM_REVERSE, SLIME_IDLE, SLIME_MOVE, PROJECTILE_EXPLOSION, - PROJECTILE_IDLE, SLIME_TAKE_HIT + TRANSFORM, IDLE, CAST, CLEAVE, DEATH, BREATH, SMASH, TAKE_HIT, WALK } /** @@ -217,12 +215,6 @@ private void animate() { case CLEAVE -> demon.getEvents().trigger("demon_cleave"); case TAKE_HIT -> demon.getEvents().trigger("demon_take_hit"); case TRANSFORM -> demon.getEvents().trigger("transform"); - case TRANSFORM_REVERSE -> demon.getEvents().trigger("transform_reverse"); - case SLIME_IDLE -> demon.getEvents().trigger("idle"); - case SLIME_MOVE -> demon.getEvents().trigger("move"); - case SLIME_TAKE_HIT -> demon.getEvents().trigger("take_hit"); - case PROJECTILE_IDLE -> demon.getEvents().trigger("projectile_explosion"); - case PROJECTILE_EXPLOSION -> demon.getEvents().trigger("projectile_idle"); default -> logger.debug("Demon animation {state} not found"); } prevState = state; @@ -295,6 +287,12 @@ private Vector2 getJumpPos() { return jumpPos; } + // jump backwards if right next to tower + if (currentPos.dst(ServiceLocator.getEntityService().getClosestEntityOfLayer( + demon, PhysicsLayer.HUMANS).getPosition()) < 2f) { + jumpPos = new Vector2(currentPos.x + JUMP_DISTANCE, currentPos.y); + } + float randomAngle = MathUtils.random(0, 2 * MathUtils.PI); float x = JUMP_DISTANCE * MathUtils.cos(randomAngle); float y = JUMP_DISTANCE * MathUtils.sin(randomAngle); diff --git a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickDeathTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickDeathTask.java new file mode 100644 index 000000000..7abfb0e88 --- /dev/null +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickDeathTask.java @@ -0,0 +1,35 @@ +package com.csse3200.game.components.tasks.bosstask; + +import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.utils.Timer; +import com.csse3200.game.ai.tasks.DefaultTask; +import com.csse3200.game.ai.tasks.PriorityTask; +import com.csse3200.game.entities.Entity; +import com.csse3200.game.entities.factories.MobBossFactory; +import com.csse3200.game.services.ServiceLocator; + +public class PatrickDeathTask extends DefaultTask implements PriorityTask { + + @Override + public void start() { + Vector2 curPos = owner.getEntity().getPosition(); + Entity patrick = MobBossFactory.patrickDead(); + patrick.setPosition(curPos); + patrick.setScale(4f,4f); + ServiceLocator.getEntityService().register(patrick); + patrick.getEvents().trigger("patrick_death"); + owner.getEntity().setFlagForDelete(true); + + // delete after half a second +// Timer.schedule(new Timer.Task() { +// @Override +// public void run() { +// patrick.setFlagForDelete(true); +// } +// }, 0.5f); + } + @Override + public int getPriority() { + return 3; + } +} diff --git a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTask.java index bbfb4d4e0..41ca88787 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTask.java @@ -15,6 +15,7 @@ import com.csse3200.game.rendering.AnimationRenderComponent; import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ServiceLocator; +import net.dermetfan.gdx.physics.box2d.PositionController; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -98,6 +99,14 @@ public void update() { } } + System.out.println(patrick.getComponent(CombatStatsComponent.class).getHealth()); + // check if patrick is dead + if (patrick.getComponent(CombatStatsComponent.class).getHealth() <= 0) { + PatrickDeathTask deathTask = new PatrickDeathTask(); + deathTask.create(owner); + deathTask.start(); + } + animate(); int health = patrick.getComponent(CombatStatsComponent.class).getHealth(); diff --git a/source/core/src/main/com/csse3200/game/entities/factories/MobBossFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/MobBossFactory.java index 06bbd6fcf..2e4b7d8be 100644 --- a/source/core/src/main/com/csse3200/game/entities/factories/MobBossFactory.java +++ b/source/core/src/main/com/csse3200/game/entities/factories/MobBossFactory.java @@ -97,7 +97,7 @@ public static Entity createSlimeyBoy() { } public static Entity createPatrickBoss(int health) { - Entity demon = createBaseBoss(); + Entity patrick = createBaseBoss(); // Animation addition AnimationRenderComponent animator = new AnimationRenderComponent( @@ -115,17 +115,48 @@ public static Entity createPatrickBoss(int health) { .addTask(new PatrickTask()); // Component addition - demon + patrick .addComponent(animator) .addComponent(new PatrickAnimationController()) .addComponent(aiTaskComponent) .addComponent(new CombatStatsComponent(health, PATRICK_ATTACK)); // Scale demon - demon.getComponent(AnimationRenderComponent.class).scaleEntity(); - demon.scaleHeight(4f); - demon.scaleWidth(4f); - return demon; + patrick.getComponent(AnimationRenderComponent.class).scaleEntity(); + patrick.scaleHeight(4f); + patrick.scaleWidth(4f); + return patrick; + } + + /* + Patrick death: cant figure out how to get another animation because + APPEAR uses "patrick_death" REVERSED. So creating a new animator to be + able to use his death animation + */ + public static Entity patrickDead() { + Entity patrick = createBaseBoss(); + + // Animation addition + AnimationRenderComponent animator = new AnimationRenderComponent( + ServiceLocator.getResourceService().getAsset("images/mobboss/patrick.atlas", TextureAtlas.class)); + animator.addAnimation("patrick_death", 0.2f, Animation.PlayMode.NORMAL); + + // AI task addition + AITaskComponent aiTaskComponent = new AITaskComponent() + .addTask(new PatrickDeathTask()); + + // Component addition + patrick + .addComponent(animator) + .addComponent(new PatrickAnimationController()) + .addComponent(aiTaskComponent) + .addComponent(new CombatStatsComponent(1, 0)); + + // Scale patrick + patrick.getComponent(AnimationRenderComponent.class).scaleEntity(); + patrick.scaleHeight(4f); + patrick.scaleWidth(4f); + return patrick; } // Create Boss King 1 From 3d97aa89bd25b22107167e94d66b70b649168128 Mon Sep 17 00:00:00 2001 From: freshc0w <121275444+freshc0w@users.noreply.github.com> Date: Thu, 28 Sep 2023 17:25:41 +1000 Subject: [PATCH 03/10] Init dodging componenent test cases --- .../game/components/npc/DodgingComponent.java | 3 +- .../game/components/DodgingComponentTest.java | 90 +++++++++++++++++++ 2 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 source/core/src/test/com/csse3200/game/components/DodgingComponentTest.java diff --git a/source/core/src/main/com/csse3200/game/components/npc/DodgingComponent.java b/source/core/src/main/com/csse3200/game/components/npc/DodgingComponent.java index bada67e3c..40c79a03c 100644 --- a/source/core/src/main/com/csse3200/game/components/npc/DodgingComponent.java +++ b/source/core/src/main/com/csse3200/game/components/npc/DodgingComponent.java @@ -37,6 +37,7 @@ public class DodgingComponent extends Component { // top and bottom detection is also taken care of, ensuring the entity will // dodge. private static final float Y_OFFSET_MOB_DETECTION = 0.35f; + public static final String DODGE_EVENT = "dodgeIncomingEntity"; /** * Initialises a component that dodges an incoming entity based on its target @@ -78,7 +79,7 @@ public DodgingComponent(short targetLayer, float rangeDetection, float dodgeSpee @Override public void create() { physics = ServiceLocator.getPhysicsService().getPhysics(); - entity.getEvents().addListener("dodgeIncomingEntity", this::changeTraverseDirection); + entity.getEvents().addListener(DODGE_EVENT, this::changeTraverseDirection); originalSpeed = entity.getComponent(PhysicsMovementComponent.class).getSpeed().y; } diff --git a/source/core/src/test/com/csse3200/game/components/DodgingComponentTest.java b/source/core/src/test/com/csse3200/game/components/DodgingComponentTest.java new file mode 100644 index 000000000..83123dfda --- /dev/null +++ b/source/core/src/test/com/csse3200/game/components/DodgingComponentTest.java @@ -0,0 +1,90 @@ +package com.csse3200.game.components; + +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; + +import com.badlogic.gdx.math.Vector2; +import com.csse3200.game.ai.tasks.AITaskComponent; +import com.csse3200.game.components.npc.DodgingComponent; +import com.csse3200.game.components.tasks.MobDodgeTask; +import com.csse3200.game.entities.Entity; +import com.csse3200.game.entities.EntityService; +import com.csse3200.game.entities.factories.NPCFactory; +import com.csse3200.game.entities.factories.ProjectileFactory; +import com.csse3200.game.extensions.GameExtension; +import com.csse3200.game.physics.PhysicsLayer; +import com.csse3200.game.physics.PhysicsService; +import com.csse3200.game.physics.components.ColliderComponent; +import com.csse3200.game.rendering.DebugRenderer; +import com.csse3200.game.rendering.RenderService; +import com.csse3200.game.services.GameTime; +import com.csse3200.game.services.ResourceService; +import com.csse3200.game.services.ServiceLocator; + +@ExtendWith(GameExtension.class) +public class DodgingComponentTest { + Entity baseMob, baseProjectile; + private static final float VALID_POSITION_Y = 3; + private static final float VALID_POSITION_X = 3; + + @BeforeEach + public void setUp() { + GameTime gameTime = mock(GameTime.class); + when(gameTime.getDeltaTime()).thenReturn(0.02f); + ServiceLocator.registerTimeSource(gameTime); + + ServiceLocator.registerPhysicsService(new PhysicsService()); + + ServiceLocator.registerEntityService(new EntityService()); + + RenderService render = new RenderService(); + render.setDebug(mock(DebugRenderer.class)); + ServiceLocator.registerRenderService(render); + + ResourceService resourceService = new ResourceService(); + ServiceLocator.registerResourceService(resourceService); + + baseMob = createDodgeMob(VALID_POSITION_X, VALID_POSITION_Y); + baseProjectile = createProjectile(VALID_POSITION_X, VALID_POSITION_Y); + } + + @Test + public void shouldNotBeNull() { + assertNotNull("Dodging combat task should not be null", baseMob.getComponent(DodgingComponent.class)); + } + + Entity createDodgeMob(float posX, float posY) { + Entity mob = NPCFactory.createRangedBaseNPC(); + mob.getComponent(AITaskComponent.class).addTask(new MobDodgeTask(new Vector2(2f, 2f), 2f, 5)); + mob.addComponent(new DodgingComponent(PhysicsLayer.PROJECTILE)); + mob.setPosition(posX, posY); + + return mob; + } + + Entity createDodgeMob(float posX, float posY, float rangeDetection, float dodgeSpeed) { + Entity mob = NPCFactory.createRangedBaseNPC(); + mob.getComponent(AITaskComponent.class).addTask(new MobDodgeTask(new Vector2(2f, 2f), 2f, 5)); + mob.addComponent(new DodgingComponent(PhysicsLayer.PROJECTILE, rangeDetection, dodgeSpeed)); + + ServiceLocator.getEntityService().register(mob); + mob.setPosition(posX, posY); + + return mob; + } + + Entity createProjectile(float posX, float posY) { + Entity projectile = ProjectileFactory.createBaseProjectile(baseMob.getComponent(ColliderComponent.class).getLayer(), + new Vector2(100, VALID_POSITION_Y), new Vector2(2f, 2f)); + + ServiceLocator.getEntityService().register(projectile); + projectile.setPosition(posX, posY); + + return projectile; + } +} From 1569d08a16695cd02776acb97e5a297f750047b6 Mon Sep 17 00:00:00 2001 From: gregchan550 <86044792+gregchan550@users.noreply.github.com> Date: Thu, 28 Sep 2023 19:03:26 +1000 Subject: [PATCH 04/10] Removed creation functions for bosses that aren't being used --- .../entities/factories/MobBossFactory.java | 57 ------------------- 1 file changed, 57 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/entities/factories/MobBossFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/MobBossFactory.java index 2e4b7d8be..974847546 100644 --- a/source/core/src/main/com/csse3200/game/entities/factories/MobBossFactory.java +++ b/source/core/src/main/com/csse3200/game/entities/factories/MobBossFactory.java @@ -159,63 +159,6 @@ public static Entity patrickDead() { return patrick; } - // Create Boss King 1 - public static Entity createMobBoss1(int numLane) { - MobBossConfigs config = configs.mobBoss; - Entity mobBoss1 = createBaseBoss(); - - AITaskComponent aiTaskComponent1 = new AITaskComponent() - .addTask(new FinalBossMovementTask(1f, numLane)) - .addTask(new MobBossDeathTask(1));; - - // Animation section - AnimationRenderComponent animator1 = new AnimationRenderComponent( - ServiceLocator.getResourceService().getAsset("images/mobs/robot.atlas", TextureAtlas.class)); - animator1.addAnimation("Walk", 0.3f, Animation.PlayMode.LOOP_REVERSED); - - mobBoss1.addComponent(new CombatStatsComponent(config.health, config.baseAttack)) - .addComponent(animator1) - .addComponent(aiTaskComponent1) - .addComponent(new Boss1AnimationController()); - - mobBoss1.getComponent(AnimationRenderComponent.class).scaleEntity(); - mobBoss1.setScale(1f, 1f); - - return mobBoss1; - } - - // Create Boss King 2 - public static Entity createMobBoss2() { - MobBossConfigs config = configs.mobBoss; - Entity mobBoss2 = createBaseBoss(); - - AITaskComponent aiTaskComponent2 = new AITaskComponent() - .addTask(new RangeBossTask(2f)); - - // Animation section - AnimationRenderComponent animator2 = new AnimationRenderComponent( - ServiceLocator.getResourceService().getAsset("images/mobs/boss2.atlas", TextureAtlas.class)); - animator2.addAnimation("boss_death", 0.3f, Animation.PlayMode.LOOP); - animator2.addAnimation("Idle", 0.3f, Animation.PlayMode.LOOP); - animator2.addAnimation("Walk", 0.3f, Animation.PlayMode.LOOP); - animator2.addAnimation("Charging", 0.3f, Animation.PlayMode.LOOP_REVERSED); - animator2.addAnimation("A1", 0.3f, Animation.PlayMode.LOOP); - animator2.addAnimation("A2", 0.3f, Animation.PlayMode.LOOP); - animator2.addAnimation("Hurt", 0.3f, Animation.PlayMode.LOOP); - - mobBoss2.addComponent(new CombatStatsComponent(config.health, config.baseAttack)) - .addComponent(animator2) - .addComponent(aiTaskComponent2) - .addComponent(new Boss2AnimationController()) - .addComponent(new PhysicsComponent()); - - mobBoss2.getComponent(AnimationRenderComponent.class).scaleEntity(); - mobBoss2.scaleHeight(3f); - mobBoss2.scaleWidth(3f); - - return mobBoss2; - } - // Create the base boss entity private static Entity createBaseBoss() { Entity boss = new Entity() From c03405f10de15b91468dc4c875e60088a87b24fd Mon Sep 17 00:00:00 2001 From: gregchan550 <86044792+gregchan550@users.noreply.github.com> Date: Thu, 28 Sep 2023 19:09:23 +1000 Subject: [PATCH 05/10] removed creation of unused bosses from forest game --- .../csse3200/game/areas/ForestGameArea.java | 50 ++----------------- 1 file changed, 5 insertions(+), 45 deletions(-) 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 4e4d7417f..72aa25f8a 100644 --- a/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java +++ b/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java @@ -284,7 +284,8 @@ public void create() { // spawnSplittingXenoGrunt(15, 5); // spawnDodgingDragonKnight(15, 3); // spawnDemonBoss(); - spawnPatrick(); +// spawnPatrick(); + spawnPatrickDeath(); // spawnFireWorm(); //mobBoss1 = spawnMobBoss1(); @@ -439,21 +440,11 @@ private void spawnPatrick() { spawnEntityAt(patrick, new GridPoint2(18, 5), true, false); } - private Entity spawnMobBoss1() { - int[] pickedLanes = random.ints(0, 8) - .distinct().limit(5).toArray(); - for (int i = 0; i < NUM_MOBBOSS1; i++) { - GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]); - mobBoss1 = MobBossFactory.createMobBoss1(pickedLanes[i]); - spawnEntityAt(mobBoss1, - randomPos, - true, - false); - } - return mobBoss1; + private void spawnPatrickDeath() { + Entity patrickDeath = MobBossFactory.patrickDead(); + spawnEntityAt(patrickDeath, new GridPoint2(18, 5), true, false); } - /** * Spawns a projectile that only heads towards the enemies in its lane. * @@ -638,37 +629,6 @@ private void spawnWaterSlime() { // return ghostKing; // // } - -// private Entity spawnMobBoss2() { -// GridPoint2 minPos = new GridPoint2(0, 0); -// GridPoint2 maxPos = terrain.getMapBounds(0).sub(2, 2); -// -// for (int i = 0; i < NUM_BOSS; i++) { -// int fixedX = terrain.getMapBounds(0).x - 1; // Rightmost x-coordinate -// int randomY = MathUtils.random(0, maxPos.y); -// GridPoint2 randomPos = new GridPoint2(fixedX, randomY); -// mobBoss2 = MobBossFactory.createMobBoss2(player); -// spawnEntityAt(mobBoss2, -// randomPos, -// true, -// false); -// } -// return mobBoss2; -// } - - private Entity spawnMobBoss2() { - int[] pickedLanes = random.ints(0, 8) - .distinct().limit(5).toArray(); - for (int i = 0; i < NUM_MOBBOSS2; i++) { - GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]); - mobBoss2 = MobBossFactory.createMobBoss2(); - spawnEntityAt(mobBoss2, - randomPos, - true, - false); - } - return mobBoss2; - } /** * Creates multiple projectiles that travel simultaneous. They all have same From 0909659e2d2abed0ed96719ac8174fdc9f7784bd Mon Sep 17 00:00:00 2001 From: freshc0w <121275444+freshc0w@users.noreply.github.com> Date: Thu, 28 Sep 2023 19:26:39 +1000 Subject: [PATCH 06/10] Add null checks for dodging component tests --- .../game/components/DodgingComponentTest.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/source/core/src/test/com/csse3200/game/components/DodgingComponentTest.java b/source/core/src/test/com/csse3200/game/components/DodgingComponentTest.java index 83123dfda..63d813191 100644 --- a/source/core/src/test/com/csse3200/game/components/DodgingComponentTest.java +++ b/source/core/src/test/com/csse3200/game/components/DodgingComponentTest.java @@ -1,7 +1,10 @@ package com.csse3200.game.components; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import org.junit.jupiter.api.BeforeEach; @@ -16,6 +19,7 @@ import com.csse3200.game.entities.EntityService; import com.csse3200.game.entities.factories.NPCFactory; import com.csse3200.game.entities.factories.ProjectileFactory; +import com.csse3200.game.events.listeners.EventListener1; import com.csse3200.game.extensions.GameExtension; import com.csse3200.game.physics.PhysicsLayer; import com.csse3200.game.physics.PhysicsService; @@ -29,8 +33,8 @@ @ExtendWith(GameExtension.class) public class DodgingComponentTest { Entity baseMob, baseProjectile; - private static final float VALID_POSITION_Y = 3; - private static final float VALID_POSITION_X = 3; + private static final float VALID_POSITION_Y = 4; + private static final float VALID_POSITION_X = 7; @BeforeEach public void setUp() { @@ -50,17 +54,23 @@ public void setUp() { ServiceLocator.registerResourceService(resourceService); baseMob = createDodgeMob(VALID_POSITION_X, VALID_POSITION_Y); - baseProjectile = createProjectile(VALID_POSITION_X, VALID_POSITION_Y); + baseProjectile = createProjectile(VALID_POSITION_X - 0.2f, VALID_POSITION_Y); } @Test - public void shouldNotBeNull() { - assertNotNull("Dodging combat task should not be null", baseMob.getComponent(DodgingComponent.class)); + public void shouldNotBeNullComponent() { + assertNotNull("Dodging combat component should not be null", baseMob.getComponent(DodgingComponent.class)); + } + + @Test + public void shouldNotBeNullTask() { + assertNotNull("Mob dodging tasks should not be null", baseMob.getComponent(AITaskComponent.class)); } Entity createDodgeMob(float posX, float posY) { Entity mob = NPCFactory.createRangedBaseNPC(); mob.getComponent(AITaskComponent.class).addTask(new MobDodgeTask(new Vector2(2f, 2f), 2f, 5)); + mob.addComponent(new CombatStatsComponent(10, 10)); mob.addComponent(new DodgingComponent(PhysicsLayer.PROJECTILE)); mob.setPosition(posX, posY); @@ -70,6 +80,7 @@ Entity createDodgeMob(float posX, float posY) { Entity createDodgeMob(float posX, float posY, float rangeDetection, float dodgeSpeed) { Entity mob = NPCFactory.createRangedBaseNPC(); mob.getComponent(AITaskComponent.class).addTask(new MobDodgeTask(new Vector2(2f, 2f), 2f, 5)); + mob.addComponent(new CombatStatsComponent(10, 10)); mob.addComponent(new DodgingComponent(PhysicsLayer.PROJECTILE, rangeDetection, dodgeSpeed)); ServiceLocator.getEntityService().register(mob); @@ -81,7 +92,7 @@ Entity createDodgeMob(float posX, float posY, float rangeDetection, float dodgeS Entity createProjectile(float posX, float posY) { Entity projectile = ProjectileFactory.createBaseProjectile(baseMob.getComponent(ColliderComponent.class).getLayer(), new Vector2(100, VALID_POSITION_Y), new Vector2(2f, 2f)); - + projectile.addComponent(new CombatStatsComponent(10, 10)); ServiceLocator.getEntityService().register(projectile); projectile.setPosition(posX, posY); From 5be037d8f5adc7f6a440698b329c51fd67f752c4 Mon Sep 17 00:00:00 2001 From: gregchan550 <86044792+gregchan550@users.noreply.github.com> Date: Thu, 28 Sep 2023 19:28:32 +1000 Subject: [PATCH 07/10] patrick death task completed --- .../csse3200/game/areas/ForestGameArea.java | 4 +-- .../tasks/bosstask/PatrickDeathTask.java | 28 +++++++++---------- .../tasks/bosstask/PatrickTask.java | 12 +++++--- 3 files changed, 24 insertions(+), 20 deletions(-) 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 72aa25f8a..b52310824 100644 --- a/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java +++ b/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java @@ -284,8 +284,8 @@ public void create() { // spawnSplittingXenoGrunt(15, 5); // spawnDodgingDragonKnight(15, 3); // spawnDemonBoss(); -// spawnPatrick(); - spawnPatrickDeath(); + spawnPatrick(); +// spawnPatrickDeath(); // spawnFireWorm(); //mobBoss1 = spawnMobBoss1(); diff --git a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickDeathTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickDeathTask.java index 7abfb0e88..4ed73349b 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickDeathTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickDeathTask.java @@ -6,28 +6,28 @@ import com.csse3200.game.ai.tasks.PriorityTask; import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.factories.MobBossFactory; +import com.csse3200.game.rendering.AnimationRenderComponent; import com.csse3200.game.services.ServiceLocator; public class PatrickDeathTask extends DefaultTask implements PriorityTask { + private boolean startFlag = false; + @Override public void start() { - Vector2 curPos = owner.getEntity().getPosition(); - Entity patrick = MobBossFactory.patrickDead(); - patrick.setPosition(curPos); - patrick.setScale(4f,4f); - ServiceLocator.getEntityService().register(patrick); - patrick.getEvents().trigger("patrick_death"); - owner.getEntity().setFlagForDelete(true); + super.start(); + startFlag = true; + owner.getEntity().getEvents().trigger("patrick_death"); + } - // delete after half a second -// Timer.schedule(new Timer.Task() { -// @Override -// public void run() { -// patrick.setFlagForDelete(true); -// } -// }, 0.5f); + @Override + public void update() { + if (startFlag && owner.getEntity().getComponent(AnimationRenderComponent.class). + isFinished()) { + owner.getEntity().setFlagForDelete(true); + } } + @Override public int getPriority() { return 3; diff --git a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTask.java index 41ca88787..009f0aaf0 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTask.java @@ -8,6 +8,7 @@ import com.csse3200.game.components.CombatStatsComponent; import com.csse3200.game.components.ProjectileEffects; import com.csse3200.game.entities.Entity; +import com.csse3200.game.entities.factories.MobBossFactory; import com.csse3200.game.entities.factories.ProjectileFactory; import com.csse3200.game.physics.PhysicsEngine; import com.csse3200.game.physics.PhysicsLayer; @@ -99,16 +100,19 @@ public void update() { } } - System.out.println(patrick.getComponent(CombatStatsComponent.class).getHealth()); // check if patrick is dead if (patrick.getComponent(CombatStatsComponent.class).getHealth() <= 0) { - PatrickDeathTask deathTask = new PatrickDeathTask(); - deathTask.create(owner); - deathTask.start(); + // play patrick death animation + Entity deadPatrick = MobBossFactory.patrickDead(); + deadPatrick.setPosition(patrick.getPosition().x, patrick.getPosition().y); + deadPatrick.setScale(4f, 4f); + ServiceLocator.getEntityService().register(deadPatrick); + patrick.setFlagForDelete(true); } animate(); int health = patrick.getComponent(CombatStatsComponent.class).getHealth(); + System.out.println(health); // detect half health if (health <= patrick.getComponent(CombatStatsComponent.class).getMaxHealth() / 2 && From a4c859aa586bd79e103e5748e9515e981434ad95 Mon Sep 17 00:00:00 2001 From: gregchan550 <86044792+gregchan550@users.noreply.github.com> Date: Thu, 28 Sep 2023 20:21:01 +1000 Subject: [PATCH 08/10] code clean up and java docs added --- .../csse3200/game/areas/ForestGameArea.java | 12 ++--- .../tasks/bosstask/DemonBossTask.java | 34 ++------------ .../tasks/bosstask/PatrickDeathTask.java | 12 ++++- .../tasks/bosstask/PatrickTask.java | 45 ++++++++++++++++--- .../tasks/bosstask/SlimeyBoyTask.java | 12 +++++ .../entities/factories/MobBossFactory.java | 36 +++++++++++---- .../entities/factories/PlayerFactory.java | 2 +- 7 files changed, 101 insertions(+), 52 deletions(-) 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 b52310824..063276c6b 100644 --- a/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java +++ b/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java @@ -268,11 +268,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); @@ -436,7 +436,7 @@ private void spawnDemonBoss() { } private void spawnPatrick() { - Entity patrick = MobBossFactory.createPatrickBoss(2500); + Entity patrick = MobBossFactory.createPatrickBoss(); spawnEntityAt(patrick, new GridPoint2(18, 5), true, false); } diff --git a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/DemonBossTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/DemonBossTask.java index 360cad774..26902cff0 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/DemonBossTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/DemonBossTask.java @@ -276,8 +276,7 @@ private void jump(Vector2 finalPos) { } /** - * Returns a a random position 3 units away for the demon to jump to. - * + * Returns a random position 3 units away for the demon to jump to. * @return a position 3 units away from the demon to jump to */ private Vector2 getJumpPos() { @@ -314,7 +313,7 @@ private Vector2 getJumpPos() { /** * Returns a boolean to confirm whether the demon has completed a jump or not. - * + * * @return if demon has completed jump or not */ private boolean jumpComplete() { @@ -392,34 +391,7 @@ private void applyAoeDamage(Array targets, int damage) { } /** -<<<<<<< HEAD - * Returns the closest human entity from a given array. - * - * @param targets array of human entities - * @return closest human entity - */ - private Entity getClosestHuman(Array targets) { - Entity closestEntity = null; - float closestDistance = SMASH_RADIUS; - - for (int i = 0; i < targets.size; i++) { - Entity targetEntity = targets.get(i); - Vector2 targetPosition = targetEntity.getPosition(); - float distance = currentPos.dst(targetPosition); - - if (distance < closestDistance) { - closestEntity = targetEntity; - closestDistance = distance; - } - } - return closestEntity; - } - - /** - * Change state to cleave and deals damage to target. -======= - * Change state to cleave and deal damage to target ->>>>>>> AOE-Projectile + * Change state to cleave and deals damage to target */ private void cleave() { changeState(DemonState.CLEAVE); diff --git a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickDeathTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickDeathTask.java index 4ed73349b..b68f60400 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickDeathTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickDeathTask.java @@ -12,7 +12,11 @@ public class PatrickDeathTask extends DefaultTask implements PriorityTask { private boolean startFlag = false; + private static final int PRIORITY = 3; + /** + * What is run when patrick's death task is assigned + */ @Override public void start() { super.start(); @@ -20,6 +24,9 @@ public void start() { owner.getEntity().getEvents().trigger("patrick_death"); } + /** + * What is run every frame + */ @Override public void update() { if (startFlag && owner.getEntity().getComponent(AnimationRenderComponent.class). @@ -28,8 +35,11 @@ public void update() { } } + /** + * @return priority of task + */ @Override public int getPriority() { - return 3; + return PRIORITY; } } diff --git a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTask.java index 009f0aaf0..faf276687 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTask.java @@ -20,6 +20,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +/** + * Patrick boss task that controls the boss' sequence and actions based on a predetermined sequence + * and the boss' current hp + */ public class PatrickTask extends DefaultTask implements PriorityTask { // Constants @@ -58,11 +62,17 @@ private enum PatrickState { IDLE, WALK, ATTACK, HURT, DEATH, SPELL, APPEAR } + /** + * Constructor for PatrickTask + */ public PatrickTask() { physics = ServiceLocator.getPhysicsService().getPhysics(); gameTime = ServiceLocator.getTimeSource(); } + /** + * What is called when the patrick task is assigned + */ @Override public void start() { super.start(); @@ -82,6 +92,9 @@ public void run() { }, 0.1f); } + /** + * Updates the sequence every frame + */ @Override public void update() { // give game time to load @@ -186,6 +199,9 @@ private void animate() { prevState = state; } + /** + * @return priority of this task + */ @Override public int getPriority() { return PRIORITY; @@ -209,6 +225,10 @@ private ProjectileEffects getEffect() { } } + /** + * Teleports patrick to the position given + * @param pos position for patrick to teleport to + */ private void teleport(Vector2 pos) { teleportTask = new PatrickTeleportTask(patrick, pos); teleportTask.create(owner); @@ -216,6 +236,9 @@ private void teleport(Vector2 pos) { teleportFlag = true; } + /** + * Patrick teleports to the closest human entity and attacks it + */ private void meleeAttack() { initialPos = patrick.getPosition(); meleeTarget = ServiceLocator.getEntityService().getClosestEntityOfLayer( @@ -224,17 +247,24 @@ private void meleeAttack() { meleeFlag = true; } - private void spawnRandProjectile(Vector2 destination) { + /** + * spawns a random effect projectile and increments the shots fired counter + * @param destination destination for projectile to travel to + */ + private void spawnRandProjectile(Vector2 destination, boolean aoe) { // spawn random projectile Entity projectile = ProjectileFactory.createEffectProjectile(PhysicsLayer.HUMANS, destination, new Vector2(2, 2), - getEffect(), false); + getEffect(), aoe); projectile.setPosition(patrick.getPosition().x, patrick.getPosition().y); projectile.setScale(-1f, 1f); ServiceLocator.getEntityService().register(projectile); shotsFired++; } + /** + * teleports to a random location within given range + */ private void randomTeleport() { // teleport to random position float randomX = MathUtils.random(RANGE_MIN_X, RANGE_MAX_X); @@ -242,25 +272,30 @@ private void randomTeleport() { teleport(new Vector2(randomX, randomY)); } + /** + * performs a random teleport and a range attack + */ private void rangeAttack() { randomTeleport(); - spawnRandProjectile(new Vector2(0f, patrick.getPosition().y)); + spawnRandProjectile(new Vector2(0f, patrick.getPosition().y), false); } + /** + * when patrick is at half health, he spawns a bunch of random aoe effect projectiles + */ private void halfHealth() { float startAngle = (float) Math.toRadians(135); float endAngle = (float) Math.toRadians(225); float angleIncrement = (endAngle - startAngle) / (HALF_HEALTH_ATTACKS - 1); for (int i = 0; i < HALF_HEALTH_ATTACKS; i++) { - randomTeleport(); // calculate unit vectors for projectiles float currentAngle = startAngle + i * angleIncrement; float x = MathUtils.cos(currentAngle) * 20; float y = MathUtils.sin(currentAngle) * 20; Vector2 destination = new Vector2(x, y); - spawnRandProjectile(destination); + spawnRandProjectile(destination, true); } if (shotsFired == HALF_HEALTH_ATTACKS) { meleeFlag = true; diff --git a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/SlimeyBoyTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/SlimeyBoyTask.java index 5cef0c8ec..7174f7a05 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/SlimeyBoyTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/SlimeyBoyTask.java @@ -31,10 +31,16 @@ public class SlimeyBoyTask extends DefaultTask implements PriorityTask { private SlimeState prevState; private Entity targetEntity; + /** + * States that the slime cycles through + */ private enum SlimeState { IDLE, MOVE, PROJECTILE_EXPLOSION, PROJECTILE_IDLE, TAKE_HIT, TRANSFORM } + /** + * What is called when task is assigned + */ @Override public void start() { super.start(); @@ -45,6 +51,9 @@ public void start() { changeState(SlimeState.TRANSFORM); } + /** + * What is run every frame update + */ @Override public void update() { animate(); @@ -146,6 +155,9 @@ private void applyAoeDamage(Array targets, int damage) { } } + /** + * @return priority of class + */ @Override public int getPriority() { return PRIORITY; diff --git a/source/core/src/main/com/csse3200/game/entities/factories/MobBossFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/MobBossFactory.java index 974847546..fb1082fe4 100644 --- a/source/core/src/main/com/csse3200/game/entities/factories/MobBossFactory.java +++ b/source/core/src/main/com/csse3200/game/entities/factories/MobBossFactory.java @@ -19,6 +19,9 @@ import com.csse3200.game.rendering.AnimationRenderComponent; import com.csse3200.game.services.ServiceLocator; +/** + * Where all entities of mob bosses are created + */ public class MobBossFactory { private static final NPCConfigs configs = FileLoader.readClass(NPCConfigs.class, "configs/Boss.json"); @@ -27,8 +30,12 @@ public class MobBossFactory { private static final int DEMON_HEALTH = 5000; private static final int DEMON_ATTACK = 0; private static final int PATRICK_ATTACK = 0; + private static final int PATRICK_HEALTH = 2500; - // Create Demon Boss + /** + * Creates the demon boss + * @return demon boss entity + */ public static Entity createDemonBoss() { Entity demon = createBaseBoss(); @@ -64,6 +71,10 @@ public static Entity createDemonBoss() { return demon; } + /** + * Creates slime that is spawned after demon boss dies + * @return slime entity + */ public static Entity createSlimeyBoy() { Entity slimeyBoy = createBaseBoss(); @@ -96,7 +107,11 @@ public static Entity createSlimeyBoy() { return slimeyBoy; } - public static Entity createPatrickBoss(int health) { + /** + * Creates the patrick boss + * @return patrick boss entity + */ + public static Entity createPatrickBoss() { Entity patrick = createBaseBoss(); // Animation addition @@ -119,7 +134,7 @@ public static Entity createPatrickBoss(int health) { .addComponent(animator) .addComponent(new PatrickAnimationController()) .addComponent(aiTaskComponent) - .addComponent(new CombatStatsComponent(health, PATRICK_ATTACK)); + .addComponent(new CombatStatsComponent(PATRICK_HEALTH, PATRICK_ATTACK)); // Scale demon patrick.getComponent(AnimationRenderComponent.class).scaleEntity(); @@ -128,10 +143,9 @@ public static Entity createPatrickBoss(int health) { return patrick; } - /* - Patrick death: cant figure out how to get another animation because - APPEAR uses "patrick_death" REVERSED. So creating a new animator to be - able to use his death animation + /** + * Creates a patrick entity whose sole purpose is to display death animation + * @return patrick death entity */ public static Entity patrickDead() { Entity patrick = createBaseBoss(); @@ -159,7 +173,10 @@ public static Entity patrickDead() { return patrick; } - // Create the base boss entity + /** + * Create base boss entity that all boss mobs will inherit + * @return base mob boss entity + */ private static Entity createBaseBoss() { Entity boss = new Entity() .addComponent(new PhysicsComponent()) @@ -173,6 +190,9 @@ private static Entity createBaseBoss() { return boss; } + /** + * Throw IllegalStateException + */ private MobBossFactory() { throw new IllegalStateException("Instantiating static util class"); } diff --git a/source/core/src/main/com/csse3200/game/entities/factories/PlayerFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/PlayerFactory.java index d77ff1d1d..adef6ba79 100644 --- a/source/core/src/main/com/csse3200/game/entities/factories/PlayerFactory.java +++ b/source/core/src/main/com/csse3200/game/entities/factories/PlayerFactory.java @@ -47,7 +47,7 @@ public static Entity createPlayer() { .addComponent(new TouchAttackComponent(PhysicsLayer.NPC)) .addComponent(new HitboxComponent().setLayer(PhysicsLayer.HUMANS)) .addComponent(new PlayerActions()) - .addComponent(new CombatStatsComponent(1000, 5000)) + .addComponent(new CombatStatsComponent(1000, 0)) .addComponent(new InventoryComponent(stats.gold)) .addComponent(inputComponent) .addComponent(aiComponent) From 9b62a9fd7aee15e8a8c165947eab20f66a2ba10a Mon Sep 17 00:00:00 2001 From: gregchan550 <86044792+gregchan550@users.noreply.github.com> Date: Thu, 28 Sep 2023 20:25:06 +1000 Subject: [PATCH 09/10] removed print statement because im about to push --- .../com/csse3200/game/areas/ForestGameArea.java | 16 +++++++--------- .../components/tasks/bosstask/PatrickTask.java | 1 - 2 files changed, 7 insertions(+), 10 deletions(-) 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 063276c6b..ab6934b8e 100644 --- a/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java +++ b/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java @@ -268,11 +268,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); @@ -283,21 +283,19 @@ public void create() { // spawnSplittingXenoGrunt(15, 4); // spawnSplittingXenoGrunt(15, 5); // spawnDodgingDragonKnight(15, 3); -// spawnDemonBoss(); + spawnDemonBoss(); spawnPatrick(); // spawnPatrickDeath(); // spawnFireWorm(); - //mobBoss1 = spawnMobBoss1(); // startWaveTimer(); //// spawnIncome(); // spawnScrap(); -// spawnTNTTower(); + spawnTNTTower(); // // spawnGapScanners(); // spawnDroidTower(); // -// mobBoss2 = spawnMobBoss2(); } diff --git a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTask.java index faf276687..9121e0c60 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTask.java @@ -125,7 +125,6 @@ public void update() { animate(); int health = patrick.getComponent(CombatStatsComponent.class).getHealth(); - System.out.println(health); // detect half health if (health <= patrick.getComponent(CombatStatsComponent.class).getMaxHealth() / 2 && From 4d36a272f80ac4f6ea8f1b75b84b8cb0fff68602 Mon Sep 17 00:00:00 2001 From: gregchan550 <86044792+gregchan550@users.noreply.github.com> Date: Thu, 28 Sep 2023 21:15:24 +1000 Subject: [PATCH 10/10] fixed build error --- .../com/csse3200/game/entities/factories/MobBossFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/core/src/main/com/csse3200/game/entities/factories/MobBossFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/MobBossFactory.java index 69c4d4eec..05b85614d 100644 --- a/source/core/src/main/com/csse3200/game/entities/factories/MobBossFactory.java +++ b/source/core/src/main/com/csse3200/game/entities/factories/MobBossFactory.java @@ -212,7 +212,7 @@ public static Entity createIceBoss() { * Create base boss entity that all boss mobs will inherit * @return base mob boss entity */ - private static Entity createBaseBoss() { + public static Entity createBaseBoss() { Entity boss = new Entity() .addComponent(new PhysicsComponent()) .addComponent(new ColliderComponent())