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 0e4e8aeee..57184f20e 100644 --- a/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java +++ b/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java @@ -140,7 +140,7 @@ public void create() { // Spawn Entities player = spawnPlayer(); spawnWeaponTower(); - spawnEngineer(player); + spawnEngineer(); bossKing1 = spawnBossKing1(); bossKing2 = spawnBossKing2(); } @@ -445,12 +445,12 @@ private void spawnIncome() { } } - private void spawnEngineer(Entity target) { + private void spawnEngineer() { GridPoint2 minPos = new GridPoint2(0, 0); - GridPoint2 maxPos = terrain.getMapBounds(0).sub(2, 2); + GridPoint2 maxPos = new GridPoint2(5, terrain.getMapBounds(0).sub(2, 2).y); GridPoint2 randomPos = RandomUtils.random(minPos, maxPos); - Entity engineer = EngineerFactory.createEngineer(target); + Entity engineer = EngineerFactory.createEngineer(); spawnEntityAt(engineer, randomPos, true, true); } diff --git a/source/core/src/main/com/csse3200/game/entities/factories/EngineerFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/EngineerFactory.java index f263a9542..8f5972e85 100644 --- a/source/core/src/main/com/csse3200/game/entities/factories/EngineerFactory.java +++ b/source/core/src/main/com/csse3200/game/entities/factories/EngineerFactory.java @@ -3,7 +3,6 @@ import com.badlogic.gdx.graphics.g2d.Animation; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.csse3200.game.ai.tasks.AITaskComponent; -import com.csse3200.game.components.tasks.EngineerCombatTask; import com.csse3200.game.components.CombatStatsComponent; import com.csse3200.game.components.TouchAttackComponent; import com.csse3200.game.components.player.HumanAnimationController; @@ -47,8 +46,8 @@ public class EngineerFactory { * * @return entity */ - public static Entity createEngineer(Entity target) { - Entity engineer = createBaseHumanNPC(target); + public static Entity createEngineer() { + Entity engineer = createBaseHumanNPC(); BaseEntityConfig config = configs.engineer; AnimationRenderComponent animator = new AnimationRenderComponent( @@ -56,7 +55,7 @@ public static Entity createEngineer(Entity target) { animator.addAnimation("walk_left", 0.2f, Animation.PlayMode.LOOP); animator.addAnimation("walk_right", 0.2f, Animation.PlayMode.LOOP); animator.addAnimation("idle_right", 0.2f, Animation.PlayMode.LOOP); - animator.addAnimation("firing", 0.01f, Animation.PlayMode.NORMAL); + animator.addAnimation("firing", 0.05f, Animation.PlayMode.NORMAL); animator.addAnimation("hit", 0.01f, Animation.PlayMode.NORMAL); animator.addAnimation("death", 0.1f, Animation.PlayMode.NORMAL); @@ -79,10 +78,8 @@ public static Entity createEngineer(Entity target) { * * @return entity */ - public static Entity createBaseHumanNPC(Entity target) { -// AITaskComponent aiComponent = -// new AITaskComponent() -// .addTask(new HumanWanderTask(target, 1f)); + public static Entity createBaseHumanNPC() { + Entity human = new Entity() diff --git a/source/core/src/test/com/csse3200/game/entities/factories/EngineerFactoryTest.java b/source/core/src/test/com/csse3200/game/entities/factories/EngineerFactoryTest.java index 424e463c3..02b9f6f0b 100644 --- a/source/core/src/test/com/csse3200/game/entities/factories/EngineerFactoryTest.java +++ b/source/core/src/test/com/csse3200/game/entities/factories/EngineerFactoryTest.java @@ -2,6 +2,7 @@ import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.g2d.TextureAtlas; +import com.csse3200.game.ai.tasks.AITaskComponent; import com.csse3200.game.entities.Entity; import com.csse3200.game.extensions.GameExtension; import com.csse3200.game.physics.PhysicsService; @@ -56,13 +57,16 @@ void tearDown() { @Test void createEngineer() { - Entity engineer = EngineerFactory.createEngineer(target); + Entity engineer = EngineerFactory.createEngineer(); + engineer.setPosition(10f, 10f); assertNotNull(engineer); + assert(!engineer.getFlagForDelete()); + assert engineer.getPosition().x == 10f && engineer.getPosition().y == 10f; } @Test void createBaseHumanNPC() { - Entity human = EngineerFactory.createBaseHumanNPC(target); + Entity human = EngineerFactory.createBaseHumanNPC(); assertNotNull(human); } } \ No newline at end of file