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 01fff275a..0a3946ff9 100644 --- a/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java +++ b/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java @@ -163,7 +163,7 @@ public void create() { spawnGhosts(); spawnWeaponTower(); - spawnEngineer(player); + spawnEngineer(); bossKing1 = spawnBossKing1(); bossKing2 = spawnBossKing2(); spawnTNTTower(); @@ -265,7 +265,7 @@ private void spawnGhosts() { private Entity spawnBossKing1() { GridPoint2 minPos = new GridPoint2(0, 0); GridPoint2 maxPos = terrain.getMapBounds(0).sub(2, 2); - GridPoint2 randomPos + GridPoint2 randomPos = new GridPoint2(0, 0); Entity ghostKing = NPCFactory.createGhostKing(player); spawnEntityAt(ghostKing, randomPos, true, true); @@ -274,12 +274,12 @@ private Entity spawnBossKing1() { /** * Spawns a projectile that only heads towards the enemies in its lane. - * + * * @param position The position of the Entity that's shooting the projectile. * @param targetLayer The enemy layer of the "shooter". * @param direction The direction the projectile should head towards. * @param speed The speed of the projectiles. - * + * */ private void spawnProjectile(Vector2 position, short targetLayer, int direction, Vector2 speed) { Entity Projectile = ProjectileFactory.createFireBall(targetLayer, new Vector2(direction, position.y), speed); @@ -288,12 +288,12 @@ private void spawnProjectile(Vector2 position, short targetLayer, int direction, } /** * Spawns a projectile specifically for general mobs/xenohunters - * + * * @param position The position of the Entity that's shooting the projectile. * @param targetLayer The enemy layer of the "shooter". * @param direction The direction the projectile should head towards. * @param speed The speed of the projectiles. - * + * */ private void spawnMobBall(Vector2 position, short targetLayer, int direction, Vector2 speed) { Entity Projectile = ProjectileFactory.createMobBall(targetLayer, new Vector2(direction, position.y), speed); @@ -303,13 +303,13 @@ private void spawnMobBall(Vector2 position, short targetLayer, int direction, Ve /** * Spawns a projectile to be used for multiple projectile function. - * + * * @param position The position of the Entity that's shooting the projectile. * @param targetLayer The enemy layer of the "shooter". * @param space The space between the projectiles' destination. * @param direction The direction the projectile should head towards. * @param speed The speed of the projectiles. - * + * */ private void spawnProjectile(Vector2 position, short targetLayer, int space, int direction, Vector2 speed) { Entity Projectile = ProjectileFactory.createFireBall(targetLayer, new Vector2(direction, position.y + space), speed); @@ -375,9 +375,9 @@ private Entity spawnBossKing2() { } /** - * Creates multiple projectiles that travel simultaneous. They all have same + * Creates multiple projectiles that travel simultaneous. They all have same * the starting point but different destinations. - * + * * @param position The position of the Entity that's shooting the projectile. * @param targetLayer The enemy layer of the "shooter". * @param direction The direction the projectile should head towards. @@ -395,7 +395,7 @@ private void spawnMultiProjectile(Vector2 position, short targetLayer, int direc /** * Returns projectile that can do an area of effect damage - * + * * @param position The position of the Entity that's shooting the projectile. * @param targetLayer The enemy layer of the "shooter". * @param direction The direction the projectile should head towards. @@ -495,15 +495,6 @@ private void spawnIncome() { } } -<<<<<<< HEAD - private void spawnEngineer(Entity target) { - GridPoint2 minPos = new GridPoint2(0, 0); - GridPoint2 maxPos = terrain.getMapBounds(0).sub(2, 2); - GridPoint2 randomPos = RandomUtils.random(minPos, maxPos); - - Entity engineer = EngineerFactory.createEngineer(target); - spawnEntityAt(engineer, randomPos, true, true); -======= private void spawnEngineer() { for (int i = 0; i < terrain.getMapBounds(0).x; i += 3) { @@ -516,6 +507,5 @@ private void spawnEngineer() { // // Entity engineer = EngineerFactory.createEngineer(); // spawnEntityAt(engineer, randomPos, true, true); ->>>>>>> b2d74629c8d3e8a1164ef90a433ff06e126011d2 } } \ No newline at end of file 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 9eff38843..7bdd6396a 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 @@ -35,11 +35,11 @@ public class EngineerFactory { private static final int COMBAT_TASK_PRIORITY = 2; private static final int ENGINEER_RANGE = 10; private static final EngineerConfigs configs = - FileLoader.readClass(EngineerConfigs.class, "configs/Engineers.json"); - + FileLoader.readClass(EngineerConfigs.class, "configs/Engineers.json"); + private static final float HUMAN_SCALE_X = 1f; private static final float HUMAN_SCALE_Y = 0.8f; - + /** * Creates an Engineer entity, based on a base Human entity, with the appropriate components and animations * @@ -49,7 +49,7 @@ public class EngineerFactory { public static Entity createEngineer() { Entity engineer = createBaseHumanNPC(); BaseEntityConfig config = configs.engineer; - + AnimationRenderComponent animator = new AnimationRenderComponent( new TextureAtlas("images/engineers/engineer.atlas")); animator.addAnimation("walk_left", 0.2f, Animation.PlayMode.LOOP); @@ -61,49 +61,43 @@ public static Entity createEngineer() { animator.addAnimation("prep", 0.05f, Animation.PlayMode.NORMAL); animator.addAnimation("hit", 0.01f, Animation.PlayMode.NORMAL); animator.addAnimation("death", 0.1f, Animation.PlayMode.NORMAL); - + AITaskComponent aiComponent = new AITaskComponent(); - + engineer .addComponent(new CombatStatsComponent(config.health, config.baseAttack)) .addComponent(animator) .addComponent(new HumanAnimationController()) .addComponent(aiComponent); - + engineer.getComponent(AITaskComponent.class).addTask(new HumanWanderTask(COMBAT_TASK_PRIORITY, ENGINEER_RANGE)); engineer.getComponent(AnimationRenderComponent.class).scaleEntity(); - engineer.getComponent(AITaskComponent.class) - .addTask(new EngineerCombatTask(COMBAT_TASK_PRIORITY, ENGINEER_RANGE)); - engineer.setScale(1.5f, 1.2f); engineer.setScale(HUMAN_SCALE_X, HUMAN_SCALE_Y); return engineer; } - + /** * Creates a generic human npc to be used as a base entity by more specific NPC creation methods. * * @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() - .addComponent(new PhysicsComponent()) - .addComponent(new PhysicsMovementComponent()) - .addComponent(new ColliderComponent()) - .addComponent(new HitboxComponent().setLayer(PhysicsLayer.ENGINEER)) - .addComponent(new TouchAttackComponent(PhysicsLayer.NPC, 1.5f)); - - + new Entity() + .addComponent(new PhysicsComponent()) + .addComponent(new PhysicsMovementComponent()) + .addComponent(new ColliderComponent()) + .addComponent(new HitboxComponent().setLayer(PhysicsLayer.ENGINEER)) + .addComponent(new TouchAttackComponent(PhysicsLayer.NPC, 1.5f)); + + PhysicsUtils.setScaledCollider(human, 0.9f, 0.4f); return human; } - + private EngineerFactory() { throw new IllegalStateException("Instantiating static util class"); } -} +} \ No newline at end of file