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 9fbd09f74..e55600818 100644 --- a/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java +++ b/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java @@ -1,23 +1,17 @@ package com.csse3200.game.areas; import com.badlogic.gdx.audio.Music; -import com.badlogic.gdx.graphics.Texture; -import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.GridPoint2; import com.badlogic.gdx.math.Vector2; -import com.csse3200.game.components.ProjectileEffects; import com.csse3200.game.areas.terrain.TerrainFactory; import com.csse3200.game.areas.terrain.TerrainFactory.TerrainType; -import com.csse3200.game.components.TouchAttackComponent; +import com.csse3200.game.components.ProjectileEffects; import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.factories.*; -import com.csse3200.game.physics.PhysicsLayer; -import com.csse3200.game.physics.components.HitboxComponent; import com.csse3200.game.utils.math.RandomUtils; import com.csse3200.game.services.ResourceService; import com.csse3200.game.services.ServiceLocator; import com.csse3200.game.components.gamearea.GameAreaDisplay; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Random; @@ -567,7 +561,7 @@ private void spawnFireWorm() { } private void spawnSkeleton() { - int[] pickedLanes = new Random().ints(1, 7) + int[] pickedLanes = random.ints(1, 7) .distinct().limit(5).toArray(); for (int i = 0; i < NUM_GRUNTS; i++) { GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]); @@ -589,7 +583,7 @@ private void spawnDragonKnight() { } private void spawnWizard() { - int[] pickedLanes = new Random().ints(1, 7) + int[] pickedLanes = random.ints(1, 7) .distinct().limit(5).toArray(); for (int i = 0; i < NUM_GRUNTS; i++) { GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]); @@ -600,7 +594,7 @@ private void spawnWizard() { } private void spawnWaterQueen() { - int[] pickedLanes = new Random().ints(1, 7) + int[] pickedLanes = random.ints(1, 7) .distinct().limit(5).toArray(); for (int i = 0; i < NUM_GRUNTS; i++) { GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]); @@ -611,7 +605,7 @@ private void spawnWaterQueen() { } private void spawnWaterSlime() { - int[] pickedLanes = new Random().ints(1, 7) + int[] pickedLanes = random.ints(1, 7) .distinct().limit(5).toArray(); for (int i = 0; i < NUM_GRUNTS; i++) { GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]); @@ -708,7 +702,7 @@ private void spawnRicochetFireball(Vector2 position, short targetLayer, int dire * * @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 direction The direction the projectile should towards. * @param speed The speed of the projectiles. * @param amount The amount of projectiles appearing after collision. */ diff --git a/source/core/src/main/com/csse3200/game/components/SplitFireworksComponent.java b/source/core/src/main/com/csse3200/game/components/SplitFireworksComponent.java index c8a578d88..0a53d7d4b 100644 --- a/source/core/src/main/com/csse3200/game/components/SplitFireworksComponent.java +++ b/source/core/src/main/com/csse3200/game/components/SplitFireworksComponent.java @@ -60,7 +60,7 @@ private void onCollisionEnd(Fixture me, Fixture other) { // * RIGHT NOW TARGET IS NPC, SUBJECT TO CHANGE // Speed is a bit faster than normal but can change. Entity newProjectile = ProjectileFactory.createFireworks(PhysicsLayer.NPC, - new Vector2(100, (float) (projectile.getPosition().y + (newDirection - (TOTAL_RANGE/2)))), new Vector2(3f, 3f)); + new Vector2(100, (float) (projectile.getPosition().y + (newDirection - (double) (TOTAL_RANGE/2)))), new Vector2(3f, 3f)); newProjectile.setPosition(newXPosition, (float) projectile.getPosition().y); diff --git a/source/core/src/main/com/csse3200/game/components/npc/SplitMoblings.java b/source/core/src/main/com/csse3200/game/components/npc/SplitMoblings.java index 39b7f2419..f762c8290 100644 --- a/source/core/src/main/com/csse3200/game/components/npc/SplitMoblings.java +++ b/source/core/src/main/com/csse3200/game/components/npc/SplitMoblings.java @@ -95,7 +95,7 @@ private void onDeath() { // Inspired by: // https://stackoverflow.com/questions/37145768/distribute-points-evenly-on-circle-circumference-in-quadrants-i-and-iv-only for (int i = 0; i < amount; i++) { - float currAngle = (360 / amount) * i; + float currAngle = (float) (360 / amount) * i; double radians = currAngle * Math.PI / 180; float newX = entity.getPosition().x + (float) OFFSET_DISTANCE * diff --git a/source/core/src/main/com/csse3200/game/components/tasks/MobAttackTask.java b/source/core/src/main/com/csse3200/game/components/tasks/MobAttackTask.java index 3cc5de175..93d09f04a 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/MobAttackTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/MobAttackTask.java @@ -5,10 +5,8 @@ import com.csse3200.game.ai.tasks.DefaultTask; import com.csse3200.game.ai.tasks.PriorityTask; import com.csse3200.game.components.TouchAttackComponent; -import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.Melee; import com.csse3200.game.entities.Weapon; -import com.csse3200.game.entities.factories.ProjectileFactory; import com.csse3200.game.physics.PhysicsEngine; import com.csse3200.game.physics.PhysicsLayer; import com.csse3200.game.physics.components.HitboxComponent; @@ -17,7 +15,6 @@ import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ServiceLocator; - /** * Task that allows mobs to shoot projectiles or melee attack towers */ diff --git a/source/core/src/main/com/csse3200/game/components/tasks/MobMeleeAttackTask.java b/source/core/src/main/com/csse3200/game/components/tasks/MobMeleeAttackTask.java index 7d2bbc634..f6e7a6f95 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/MobMeleeAttackTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/MobMeleeAttackTask.java @@ -5,10 +5,8 @@ import com.csse3200.game.ai.tasks.DefaultTask; import com.csse3200.game.ai.tasks.PriorityTask; import com.csse3200.game.components.TouchAttackComponent; -import com.csse3200.game.entities.Entity; import com.csse3200.game.entities.Melee; import com.csse3200.game.entities.Weapon; -import com.csse3200.game.entities.factories.ProjectileFactory; import com.csse3200.game.physics.PhysicsEngine; import com.csse3200.game.physics.PhysicsLayer; import com.csse3200.game.physics.components.HitboxComponent; @@ -17,7 +15,6 @@ import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ServiceLocator; - /** * Task that allows mobs to shoot projectiles or melee attack towers */ diff --git a/source/core/src/main/com/csse3200/game/components/tasks/MobShootTask.java b/source/core/src/main/com/csse3200/game/components/tasks/MobShootTask.java index f339e4999..40c50142a 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/MobShootTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/MobShootTask.java @@ -4,21 +4,15 @@ import com.badlogic.gdx.physics.box2d.Fixture; import com.csse3200.game.ai.tasks.DefaultTask; import com.csse3200.game.ai.tasks.PriorityTask; -import com.csse3200.game.components.TouchAttackComponent; import com.csse3200.game.entities.Entity; -import com.csse3200.game.entities.Melee; -import com.csse3200.game.entities.Weapon; import com.csse3200.game.entities.factories.ProjectileFactory; import com.csse3200.game.physics.PhysicsEngine; import com.csse3200.game.physics.PhysicsLayer; -import com.csse3200.game.physics.components.HitboxComponent; import com.csse3200.game.physics.components.PhysicsMovementComponent; import com.csse3200.game.physics.raycast.RaycastHit; -import com.csse3200.game.rendering.AnimationRenderComponent; import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ServiceLocator; - /** * Task that allows mobs to shoot projectiles or melee attack towers */ diff --git a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/FinalBossMovementTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/FinalBossMovementTask.java index 3cdf87858..34ebf7bae 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/FinalBossMovementTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/FinalBossMovementTask.java @@ -120,7 +120,7 @@ private void startSwappingLane() { currentTask.stop(); - float laneHeight = (float) (viewportHeight / 8); + float laneHeight = (float) (viewportHeight) / 8; if (currLane == 0) { // Move up diff --git a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/IceBabyTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/IceBabyTask.java index fc8cb7619..377eaa936 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/IceBabyTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/IceBabyTask.java @@ -9,7 +9,6 @@ import com.csse3200.game.components.CombatStatsComponent; import com.csse3200.game.components.tasks.MovementTask; import com.csse3200.game.entities.Entity; -import com.csse3200.game.entities.factories.MobBossFactory; import com.csse3200.game.entities.factories.NPCFactory; import com.csse3200.game.physics.PhysicsEngine; import com.csse3200.game.physics.PhysicsLayer; @@ -18,13 +17,9 @@ import com.csse3200.game.rendering.AnimationRenderComponent; import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ServiceLocator; -import net.dermetfan.gdx.physics.box2d.PositionController; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.Serial; -import java.text.DecimalFormat; - public class IceBabyTask extends DefaultTask implements PriorityTask { private static final int PRIORITY = 3; private static final Vector2 ICEBABY_SPEED = new Vector2(1f, 1f); diff --git a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTeleportTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTeleportTask.java index 54ef0e71a..463c3979b 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTeleportTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/PatrickTeleportTask.java @@ -5,7 +5,6 @@ import com.csse3200.game.components.CombatStatsComponent; import com.csse3200.game.components.tasks.MovementTask; import com.csse3200.game.entities.Entity; -import com.csse3200.game.entities.factories.MobBossFactory; import com.csse3200.game.rendering.AnimationRenderComponent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/source/core/src/main/com/csse3200/game/screens/DesertGameScreen.java b/source/core/src/main/com/csse3200/game/screens/DesertGameScreen.java index 649190860..fee0b0280 100644 --- a/source/core/src/main/com/csse3200/game/screens/DesertGameScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/DesertGameScreen.java @@ -62,7 +62,7 @@ public DesertGameScreen(GdxGame game) { this.game = game; camera = new OrthographicCamera(); camera.setToOrtho(false, viewportWidth, viewportHeight); - camera.position.set((float) (viewportWidth / 2), (float) (viewportHeight / 2), 0); + camera.position.set((float) (viewportWidth) / 2, (float) (viewportHeight) / 2, 0); batch = new SpriteBatch(); diff --git a/source/core/src/main/com/csse3200/game/screens/IceGameScreen.java b/source/core/src/main/com/csse3200/game/screens/IceGameScreen.java index e35c88b85..dc825de39 100644 --- a/source/core/src/main/com/csse3200/game/screens/IceGameScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/IceGameScreen.java @@ -62,7 +62,7 @@ public IceGameScreen(GdxGame game) { this.game = game; camera = new OrthographicCamera(); camera.setToOrtho(false, viewportWidth, viewportHeight); - camera.position.set((float) (viewportWidth / 2), (float) (viewportHeight / 2), 0); + camera.position.set((float) (viewportWidth) / 2, (float) (viewportHeight) / 2, 0); batch = new SpriteBatch(); diff --git a/source/core/src/main/com/csse3200/game/screens/LavaGameScreen.java b/source/core/src/main/com/csse3200/game/screens/LavaGameScreen.java index a0ec8d06f..a2c641168 100644 --- a/source/core/src/main/com/csse3200/game/screens/LavaGameScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/LavaGameScreen.java @@ -62,7 +62,7 @@ public LavaGameScreen(GdxGame game) { this.game = game; camera = new OrthographicCamera(); camera.setToOrtho(false, viewportWidth, viewportHeight); - camera.position.set((float) (viewportWidth / 2), (float) (viewportHeight / 2), 0); + camera.position.set((float) (viewportWidth) / 2, (float) (viewportHeight) / 2, 0); batch = new SpriteBatch(); diff --git a/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java b/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java index 4cadb1db3..2aeef83c3 100644 --- a/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java @@ -9,7 +9,6 @@ import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.utils.viewport.ScreenViewport; -import com.badlogic.gdx.utils.viewport.Viewport; import com.csse3200.game.GdxGame; import com.csse3200.game.areas.ForestGameArea; import com.csse3200.game.areas.terrain.TerrainFactory; @@ -68,7 +67,7 @@ public MainGameScreen(GdxGame game) { this.game = game; camera = new OrthographicCamera(); camera.setToOrtho(false, viewportWidth, viewportHeight); - camera.position.set((float) (viewportWidth / 2), (float) (viewportHeight / 2), 0); + camera.position.set((float) (viewportWidth) / 2, (float) (viewportHeight) / 2, 0); batch = new SpriteBatch();