Skip to content

Commit

Permalink
Fix dodge dragon knight tasks not appearing in game
Browse files Browse the repository at this point in the history
  • Loading branch information
freshc0w committed Oct 10, 2023
1 parent 5ebcfc0 commit 43539c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.csse3200.game.components.tasks;

import com.badlogic.gdx.math.Vector2;
import com.csse3200.game.components.tasks.MobTask.MobTask;
import com.csse3200.game.components.tasks.MobTask.MobType;
import com.csse3200.game.services.GameTime;
import com.csse3200.game.services.ServiceLocator;

Expand All @@ -14,7 +16,7 @@
* "dodgeIncomingEntity" event to the attached entity.
* </p>
*/
public class MobDodgeTask extends MobWanderTask {
public class MobDodgeTask extends MobTask {

private final int priority; // active priority

Expand All @@ -34,8 +36,8 @@ public class MobDodgeTask extends MobWanderTask {
* @param waitTime How long in seconds to wait between wandering.
* @param priority Priority level compared to other added tasks.
*/
public MobDodgeTask(Vector2 wanderRange, float waitTime, int priority) {
super(wanderRange, waitTime);
public MobDodgeTask(MobType mobType, int priority) {
super(mobType);
this.priority = priority;

timeSource = ServiceLocator.getTimeSource();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,8 @@ public static Entity createSplittingXenoGrunt(int health) {
.addComponent(new DodgingComponent(PhysicsLayer.PROJECTILE, 0.25f));

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

Expand All @@ -489,8 +490,9 @@ public static Entity createDodgingDragonKnight(int health) {
Entity dodgeKnight = createDragonKnight(health);

dodgeKnight.addComponent(new DodgingComponent(PhysicsLayer.PROJECTILE, 0.25f));
dodgeKnight.getComponent(AITaskComponent.class).addTask(new MobDodgeTask(new Vector2(2f, 2f), 2f, 5));

// dodgeKnight.getComponent(AITaskComponent.class).addTask(new MobDodgeTask(new Vector2(2f, 2f), 2f, 5));
dodgeKnight.getComponent(AITaskComponent.class).
addTask(new MobDodgeTask(MobType.DRAGON_KNIGHT, 5));
PhysicsUtils.setScaledCollider(dodgeKnight, 0.3f, 0.7f);
dodgeKnight.setScale(0.3f, 0.7f);

Expand Down

0 comments on commit 43539c5

Please sign in to comment.