Skip to content

Commit

Permalink
Removed target entity from all boss creation parameters because it wa…
Browse files Browse the repository at this point in the history
…s redundant and made a new createDemonBoss method in MobBossFactory
  • Loading branch information
gregchan550 committed Sep 16, 2023
1 parent 01b5ed4 commit c3d57c1
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ private Entity spawnMobBoss1() {
.distinct().limit(5).toArray();
for (int i = 0; i < NUM_MOBBOSS1; i++) {
GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]);
mobBoss1 = MobBossFactory.createMobBoss1(player, pickedLanes[i]);
mobBoss1 = MobBossFactory.createMobBoss1(pickedLanes[i]);
spawnEntityAt(mobBoss1,
randomPos,
true,
Expand Down Expand Up @@ -506,7 +506,7 @@ private Entity spawnMobBoss2() {
.distinct().limit(5).toArray();
for (int i = 0; i < NUM_MOBBOSS2; i++) {
GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]);
mobBoss2 = MobBossFactory.createMobBoss2(player);
mobBoss2 = MobBossFactory.createMobBoss2();
spawnEntityAt(mobBoss2,
randomPos,
true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
package com.csse3200.game.components.tasks.bosstask;

import com.badlogic.gdx.math.Vector2;
import com.csse3200.game.ai.tasks.DefaultTask;
import com.csse3200.game.ai.tasks.PriorityTask;
import com.csse3200.game.components.tasks.MovementTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DemonBossMovementTask extends DefaultTask implements PriorityTask {

private static final Logger logger = LoggerFactory.getLogger(DemonBossMovementTask.class);
private int priority;
private static final int PRIORITY = 3;
private Vector2 currentPos;
private MovementTask movementTask;

private enum STATE {
WALK, JUMP, IDLE
}
private STATE demonState = STATE.IDLE;

public DemonBossMovementTask() {

}
@Override
public int getPriority() {
return this.priority;
return PRIORITY;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.csse3200.game.components.*;
import com.csse3200.game.components.npc.Boss1AnimationController;
import com.csse3200.game.components.npc.Boss2AnimationController;
import com.csse3200.game.components.tasks.bosstask.DemonBossMovementTask;
import com.csse3200.game.components.tasks.bosstask.FinalBossMovementTask;
import com.csse3200.game.components.tasks.bosstask.RangeBossTask;
import com.csse3200.game.components.tasks.bosstask.bossDeathTask;
Expand All @@ -25,10 +26,26 @@ public class MobBossFactory {
private static final int PRIORITY = 1;
private static final int BOSS_MOB_AGRO_RANGE = 10;

// Create Demon Boss
private static Entity createDemonBoss() {
MobBossConfigs config = configs.MobBoss;
Entity demon = createBaseBoss();

// Animation addition

// AI task addition
AITaskComponent aiTaskComponent = new AITaskComponent()
.addTask(new DemonBossMovementTask());

// Component addition

return demon;
}

// Create Boss King 1
public static Entity createMobBoss1(Entity target, int numLane) {
public static Entity createMobBoss1(int numLane) {
MobBossConfigs config = configs.MobBoss;
Entity mobBoss1 = createBaseBoss(target);
Entity mobBoss1 = createBaseBoss();

AITaskComponent aiTaskComponent1 = new AITaskComponent()
.addTask(new FinalBossMovementTask(1f, numLane))
Expand All @@ -51,9 +68,9 @@ public static Entity createMobBoss1(Entity target, int numLane) {
}

// Create Boss King 2
public static Entity createMobBoss2(Entity target) {
public static Entity createMobBoss2() {
MobBossConfigs config = configs.MobBoss;
Entity mobBoss2 = createBaseBoss(target);
Entity mobBoss2 = createBaseBoss();

AITaskComponent aiTaskComponent2 = new AITaskComponent()
.addTask(new RangeBossTask(2f));
Expand Down Expand Up @@ -83,7 +100,7 @@ public static Entity createMobBoss2(Entity target) {
}

// Create the base boss entity
private static Entity createBaseBoss(Entity target) {
private static Entity createBaseBoss() {
Entity boss = new Entity()
.addComponent(new PhysicsComponent())
.addComponent(new ColliderComponent())
Expand Down

0 comments on commit c3d57c1

Please sign in to comment.