From 7c9e95f655fdb7d73d4711fe5f68eac00beac6cf Mon Sep 17 00:00:00 2001 From: Thivan W Date: Wed, 6 Sep 2023 14:48:42 +1000 Subject: [PATCH 1/4] added range boss's ranged attack during pause --- .../components/tasks/RangeBossMovementTask.java | 15 +++++++++++---- .../game/entities/factories/BossKingFactory.java | 4 ++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/components/tasks/RangeBossMovementTask.java b/source/core/src/main/com/csse3200/game/components/tasks/RangeBossMovementTask.java index 15db419ea..6518d00e7 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/RangeBossMovementTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/RangeBossMovementTask.java @@ -4,6 +4,9 @@ import com.csse3200.game.ai.tasks.DefaultTask; import com.csse3200.game.ai.tasks.PriorityTask; import com.csse3200.game.ai.tasks.Task; +import com.csse3200.game.entities.Entity; +import com.csse3200.game.entities.factories.ProjectileFactory; +import com.csse3200.game.services.ServiceLocator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -15,7 +18,7 @@ public class RangeBossMovementTask extends DefaultTask implements PriorityTask { private static final Logger logger = LoggerFactory.getLogger(RangeBossMovementTask.class); private final float waitTime; - private Vector2 startPos; + private Vector2 currentPos; private MovementTask movementTask; private WaitTask waitTask; private Task currentTask; @@ -36,11 +39,11 @@ public int getPriority() { @Override public void start() { super.start(); - startPos = owner.getEntity().getPosition(); + currentPos = owner.getEntity().getPosition(); waitTask = new WaitTask(waitTime); waitTask.create(owner); - movementTask = new MovementTask(startPos.sub(2,0)); + movementTask = new MovementTask(currentPos.sub(2,0)); movementTask.create(owner); movementTask.start(); @@ -54,6 +57,10 @@ public void start() { public void update() { if (currentTask.getStatus() != Status.ACTIVE) { if (currentTask == movementTask) { + Entity newProjectile = ProjectileFactory.createFireBall(owner.getEntity(), new Vector2(0, (currentPos.y + 0.75f)), new Vector2(2f,2f)); + newProjectile.scaleHeight(-0.4f); + newProjectile.setPosition((float) (currentPos.x), (float) (currentPos.y+0.75f)); + ServiceLocator.getEntityService().register(newProjectile); startWaiting(); } else { startMoving(); @@ -69,7 +76,7 @@ private void startWaiting() { private void startMoving() { logger.debug("Starting moving"); - movementTask.setTarget(startPos.sub(2,0)); + movementTask.setTarget(currentPos.sub(2,0)); swapTask(movementTask); } diff --git a/source/core/src/main/com/csse3200/game/entities/factories/BossKingFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/BossKingFactory.java index 1bd29a628..23b840298 100644 --- a/source/core/src/main/com/csse3200/game/entities/factories/BossKingFactory.java +++ b/source/core/src/main/com/csse3200/game/entities/factories/BossKingFactory.java @@ -61,8 +61,8 @@ public static Entity createBossKing1(Entity target) { .addComponent(new BossAnimationController()); bossKing1.getComponent(AnimationRenderComponent.class).scaleEntity(); - bossKing1.scaleHeight(0.5f); - bossKing1.scaleWidth(0.5f); + bossKing1.setScale(-1f,1f); + return bossKing1; } From 1207d5e1d907438b4aaa55a8a4249d9e788328a7 Mon Sep 17 00:00:00 2001 From: ThivanW <140519988+ThivanW@users.noreply.github.com> Date: Sat, 9 Sep 2023 16:38:18 +1000 Subject: [PATCH 2/4] changed the projectile called in the range boss task --- .../csse3200/game/components/tasks/RangeBossMovementTask.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/components/tasks/RangeBossMovementTask.java b/source/core/src/main/com/csse3200/game/components/tasks/RangeBossMovementTask.java index 6518d00e7..b2906848e 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/RangeBossMovementTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/RangeBossMovementTask.java @@ -57,7 +57,7 @@ public void start() { public void update() { if (currentTask.getStatus() != Status.ACTIVE) { if (currentTask == movementTask) { - Entity newProjectile = ProjectileFactory.createFireBall(owner.getEntity(), new Vector2(0, (currentPos.y + 0.75f)), new Vector2(2f,2f)); + Entity newProjectile = ProjectileFactory.createFireball(owner.getEntity(), new Vector2(0, (currentPos.y + 0.75f)), new Vector2(2f,2f)); newProjectile.scaleHeight(-0.4f); newProjectile.setPosition((float) (currentPos.x), (float) (currentPos.y+0.75f)); ServiceLocator.getEntityService().register(newProjectile); @@ -88,4 +88,4 @@ private void swapTask(Task newTask) { currentTask.start(); } -} \ No newline at end of file +} From 4a6823b06917fe9a396c9592aa0393029438207d Mon Sep 17 00:00:00 2001 From: ThivanW <140519988+ThivanW@users.noreply.github.com> Date: Sat, 9 Sep 2023 16:41:32 +1000 Subject: [PATCH 3/4] Fixed capitalization on createFireBall call --- .../csse3200/game/components/tasks/RangeBossMovementTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/core/src/main/com/csse3200/game/components/tasks/RangeBossMovementTask.java b/source/core/src/main/com/csse3200/game/components/tasks/RangeBossMovementTask.java index b2906848e..1c6897069 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/RangeBossMovementTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/RangeBossMovementTask.java @@ -57,7 +57,7 @@ public void start() { public void update() { if (currentTask.getStatus() != Status.ACTIVE) { if (currentTask == movementTask) { - Entity newProjectile = ProjectileFactory.createFireball(owner.getEntity(), new Vector2(0, (currentPos.y + 0.75f)), new Vector2(2f,2f)); + Entity newProjectile = ProjectileFactory.createFireBall(owner.getEntity(), new Vector2(0, (currentPos.y + 0.75f)), new Vector2(2f,2f)); newProjectile.scaleHeight(-0.4f); newProjectile.setPosition((float) (currentPos.x), (float) (currentPos.y+0.75f)); ServiceLocator.getEntityService().register(newProjectile); From cba4021ef637ba61d09fb03d662ba345aa3d0135 Mon Sep 17 00:00:00 2001 From: ThivanW <140519988+ThivanW@users.noreply.github.com> Date: Sat, 9 Sep 2023 16:53:04 +1000 Subject: [PATCH 4/4] Changed the createFireBall code to match what is called in the main branch --- .../csse3200/game/components/tasks/RangeBossMovementTask.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/core/src/main/com/csse3200/game/components/tasks/RangeBossMovementTask.java b/source/core/src/main/com/csse3200/game/components/tasks/RangeBossMovementTask.java index 1c6897069..87f51b1a3 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/RangeBossMovementTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/RangeBossMovementTask.java @@ -7,6 +7,7 @@ import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.factories.ProjectileFactory; import com.csse3200.game.services.ServiceLocator; +import com.csse3200.game.physics.PhysicsLayer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -57,7 +58,8 @@ public void start() { public void update() { if (currentTask.getStatus() != Status.ACTIVE) { if (currentTask == movementTask) { - Entity newProjectile = ProjectileFactory.createFireBall(owner.getEntity(), new Vector2(0, (currentPos.y + 0.75f)), new Vector2(2f,2f)); + Entity newProjectile = ProjectileFactory.createFireBall(PhysicsLayer.OBSTACLE, new Vector2(0, currentPos.y + 0.75f), new Vector2(2f,2f)); + newProjectile.scaleHeight(-0.4f); newProjectile.setPosition((float) (currentPos.x), (float) (currentPos.y+0.75f)); ServiceLocator.getEntityService().register(newProjectile);