full split into handlers, separation of concerns, cleanup
This commit is contained in:
@@ -1,48 +1,28 @@
|
||||
package org.lumijiez.bugger;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer;
|
||||
import com.badlogic.gdx.physics.box2d.World;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import org.lumijiez.bugger.entities.Entity;
|
||||
import org.lumijiez.bugger.entities.Player;
|
||||
import org.lumijiez.bugger.entities.enemies.*;
|
||||
import org.lumijiez.bugger.entities.weapons.Ray;
|
||||
import org.lumijiez.bugger.entities.weapons.Projectile;
|
||||
import org.lumijiez.bugger.handlers.*;
|
||||
import org.lumijiez.bugger.vfx.ParticleManager;
|
||||
import org.lumijiez.bugger.vfx.SpaceBackground;
|
||||
import org.lumijiez.bugger.handlers.ParticleHandler;
|
||||
import org.lumijiez.bugger.handlers.SpaceVFXHandler;
|
||||
|
||||
public class Bugger {
|
||||
private static Bugger instance;
|
||||
private final World world = new World(new Vector2(0, 0), true);;
|
||||
private final SpaceBackground spaceBackground = new SpaceBackground();
|
||||
private final Box2DDebugRenderer debugRenderer = new Box2DDebugRenderer();
|
||||
public static SpriteBatch spriteBatch = new SpriteBatch();
|
||||
public static SpriteBatch uiBatch = new SpriteBatch();
|
||||
public static OrthographicCamera cam;
|
||||
public static OrthographicCamera uiCam;
|
||||
private final Player player;
|
||||
public static int kills = 0;
|
||||
|
||||
private Bugger() {
|
||||
this.player = Player.getInstance();
|
||||
this.player.setPlayer(world, 100, 100);
|
||||
this.world.setContactListener(new GameContactListener());
|
||||
|
||||
cam = new OrthographicCamera(160, 90);
|
||||
cam.position.set(Player.getInstance().getPosition().x / 2f, Player.getInstance().getPosition().y / 2f, 0);
|
||||
cam.update();
|
||||
|
||||
uiCam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
uiCam.position.set(uiCam.viewportWidth / 2, uiCam.viewportHeight / 2, 0);
|
||||
uiCam.update();
|
||||
Player.getInstance().setPlayer(world, 100, 100);
|
||||
this.world.setContactListener(new CollisionHandler());
|
||||
}
|
||||
|
||||
public static Bugger getInstance() {
|
||||
@@ -54,40 +34,27 @@ public class Bugger {
|
||||
|
||||
public void cycle(float delta) {
|
||||
renderClear();
|
||||
renderBackground();
|
||||
SpaceVFXHandler.getInstance().render();
|
||||
|
||||
step();
|
||||
|
||||
cycleProjectiles(delta);
|
||||
ProjectileHandler.getInstance().cycle(delta);
|
||||
EnemyHandler.getInstance().cycle();
|
||||
cycleParticles(delta);
|
||||
ParticleHandler.getInstance().cycle(delta);
|
||||
|
||||
EntityCleaner.getInstance().tryClean();
|
||||
CleanupHandler.getInstance().tryClean();
|
||||
|
||||
updateCamera();
|
||||
CameraHandler.getInstance().updateCamera();
|
||||
|
||||
Player.getInstance().render();
|
||||
|
||||
renderPlayer();
|
||||
EnemyHandler.getInstance().render(delta);
|
||||
// renderDebug();
|
||||
|
||||
UIRenderer.getInstance().renderUI();
|
||||
InterfaceHandler.getInstance().renderUI();
|
||||
InputHandler.getInstance().handleInput();
|
||||
}
|
||||
|
||||
public void updateCamera() {
|
||||
cam.position.set(player.getBody().getPosition().x, player.getBody().getPosition().y, 0);
|
||||
cam.update();
|
||||
spriteBatch.setProjectionMatrix(cam.combined);
|
||||
}
|
||||
|
||||
public void renderBackground() {
|
||||
spaceBackground.render();
|
||||
}
|
||||
|
||||
public void renderPlayer() {
|
||||
player.render();
|
||||
}
|
||||
|
||||
public void renderClear() {
|
||||
Gdx.gl.glClearColor(0.1f, 0.1f, 0.1f, 1);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
@@ -97,43 +64,15 @@ public class Bugger {
|
||||
debugRenderer.render(world, spriteBatch.getProjectionMatrix());
|
||||
}
|
||||
|
||||
public void cycleProjectiles(float delta) {
|
||||
for (Projectile arrow : projectiles) {
|
||||
if (!arrow.isMarkedToDestroy()) {
|
||||
arrow.update(delta);
|
||||
arrow.render();
|
||||
} else {
|
||||
entitiesToDestroy.add(arrow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void cycleParticles(float delta) {
|
||||
ParticleManager.getInstance().update(delta);
|
||||
ParticleManager.getInstance().render(spriteBatch);
|
||||
}
|
||||
|
||||
public void step() {
|
||||
world.step(1 / 30f, 6, 2);
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
EntityCleaner.getInstance().disposeAll();
|
||||
CleanupHandler.getInstance().disposeAll();
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public Array<Projectile> getProjectiles() {
|
||||
return projectiles;
|
||||
}
|
||||
|
||||
public SpaceBackground getSpaceBackground() {
|
||||
return spaceBackground;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.badlogic.gdx.physics.box2d.*;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import org.lumijiez.bugger.Bugger;
|
||||
import org.lumijiez.bugger.entities.weapons.Ray;
|
||||
import org.lumijiez.bugger.handlers.CameraHandler;
|
||||
|
||||
public class Player extends Entity {
|
||||
private static Player instance;
|
||||
@@ -78,7 +79,7 @@ public class Player extends Entity {
|
||||
float mouseX = Gdx.input.getX();
|
||||
float mouseY = Gdx.input.getY();
|
||||
|
||||
Vector3 mousePosition = Bugger.cam.unproject(new Vector3(mouseX, mouseY, 0));
|
||||
Vector3 mousePosition = CameraHandler.getInstance().getCamera().unproject(new Vector3(mouseX, mouseY, 0));
|
||||
|
||||
Vector2 direction = new Vector2(mousePosition.x, mousePosition.y).sub(body.getPosition()).nor();
|
||||
|
||||
@@ -93,7 +94,7 @@ public class Player extends Entity {
|
||||
float mouseX = Gdx.input.getX();
|
||||
float mouseY = Gdx.input.getY();
|
||||
|
||||
Vector3 mousePosition = Bugger.cam.unproject(new Vector3(mouseX, mouseY, 0));
|
||||
Vector3 mousePosition = CameraHandler.getInstance().getCamera().unproject(new Vector3(mouseX, mouseY, 0));
|
||||
|
||||
direction.set(mousePosition.x, mousePosition.y).sub(getPosition()).nor();
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.physics.box2d.World;
|
||||
import org.lumijiez.bugger.Bugger;
|
||||
import org.lumijiez.bugger.entities.Entity;
|
||||
import org.lumijiez.bugger.entities.Player;
|
||||
|
||||
public class EnemyEntity extends Entity {
|
||||
public EnemyEntity(World world, String texturePath, float size) {
|
||||
@@ -15,7 +16,7 @@ public class EnemyEntity extends Entity {
|
||||
}
|
||||
|
||||
public void update() {
|
||||
Vector2 playerPos = Bugger.getInstance().getPlayer().getPosition();
|
||||
Vector2 playerPos = Player.getInstance().getPosition();
|
||||
follow(playerPos);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
package org.lumijiez.bugger.entities.weapons;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.Sprite;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.physics.box2d.*;
|
||||
import org.lumijiez.bugger.Bugger;
|
||||
import org.lumijiez.bugger.entities.Entity;
|
||||
|
||||
public abstract class Projectile extends Entity {
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package org.lumijiez.bugger.handlers;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||
import org.lumijiez.bugger.Bugger;
|
||||
import org.lumijiez.bugger.entities.Player;
|
||||
|
||||
public class CameraHandler {
|
||||
private static CameraHandler instance;
|
||||
|
||||
private final OrthographicCamera cam;
|
||||
private final OrthographicCamera uiCam;
|
||||
|
||||
private CameraHandler() {
|
||||
cam = new OrthographicCamera(160, 90);
|
||||
cam.position.set(Player.getInstance().getPosition().x / 2f, Player.getInstance().getPosition().y / 2f, 0);
|
||||
cam.update();
|
||||
|
||||
uiCam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
uiCam.position.set(uiCam.viewportWidth / 2, uiCam.viewportHeight / 2, 0);
|
||||
uiCam.update();
|
||||
}
|
||||
|
||||
public static CameraHandler getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new CameraHandler();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public OrthographicCamera getCamera() {
|
||||
return cam;
|
||||
}
|
||||
|
||||
public OrthographicCamera getUICamera() {
|
||||
return uiCam;
|
||||
}
|
||||
|
||||
public void updateCamera() {
|
||||
Player player = Player.getInstance();
|
||||
cam.position.set(player.getBody().getPosition().x, player.getBody().getPosition().y, 0);
|
||||
cam.update();
|
||||
Bugger.spriteBatch.setProjectionMatrix(cam.combined);
|
||||
}
|
||||
}
|
||||
@@ -6,27 +6,26 @@ import org.lumijiez.bugger.Bugger;
|
||||
import org.lumijiez.bugger.entities.Entity;
|
||||
import org.lumijiez.bugger.entities.enemies.EnemyEntity;
|
||||
import org.lumijiez.bugger.entities.weapons.Projectile;
|
||||
import org.lumijiez.bugger.vfx.ParticleManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EntityCleaner {
|
||||
public class CleanupHandler {
|
||||
private final Array<Entity> entitiesToDestroy = new Array<>();
|
||||
|
||||
private static EntityCleaner instance;
|
||||
private static CleanupHandler instance;
|
||||
|
||||
private EntityCleaner() {}
|
||||
private CleanupHandler() {}
|
||||
|
||||
public static EntityCleaner getInstance() {
|
||||
public static CleanupHandler getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new EntityCleaner();
|
||||
instance = new CleanupHandler();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void tryClean() {
|
||||
Array<Entity> entities = entitiesToDestroy;
|
||||
Array<Projectile> projectiles = Bugger.getInstance().getProjectiles();
|
||||
Array<Projectile> projectiles = ProjectileHandler.getInstance().getProjectiles();
|
||||
List<EnemyEntity> enemies = EnemyHandler.getInstance().getEnemies();
|
||||
World world = Bugger.getInstance().getWorld();
|
||||
|
||||
@@ -38,7 +37,7 @@ public class EntityCleaner {
|
||||
}
|
||||
|
||||
if (entity instanceof EnemyEntity) {
|
||||
ParticleManager.getInstance().playEffect(entity.getBody().getPosition().x, entity.getBody().getPosition().y);
|
||||
ParticleHandler.getInstance().playEffect(entity.getBody().getPosition().x, entity.getBody().getPosition().y);
|
||||
enemies.remove(entity);
|
||||
}
|
||||
|
||||
@@ -54,7 +53,7 @@ public class EntityCleaner {
|
||||
Bugger.spriteBatch.dispose();
|
||||
Bugger.uiBatch.dispose();
|
||||
Bugger.getInstance().getWorld().dispose();
|
||||
Bugger.getInstance().getSpaceBackground().dispose();
|
||||
ParticleManager.getInstance().dispose();
|
||||
SpaceVFXHandler.getInstance().dispose();
|
||||
ParticleHandler.getInstance().dispose();
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import org.lumijiez.bugger.Bugger;
|
||||
import org.lumijiez.bugger.entities.enemies.EnemyEntity;
|
||||
import org.lumijiez.bugger.entities.weapons.Ray;
|
||||
|
||||
public class GameContactListener implements ContactListener {
|
||||
public class CollisionHandler implements ContactListener {
|
||||
@Override
|
||||
public void beginContact(Contact contact) {
|
||||
Fixture fixtureA = contact.getFixtureA();
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.lumijiez.bugger.handlers;
|
||||
|
||||
import org.lumijiez.bugger.Bugger;
|
||||
import org.lumijiez.bugger.entities.enemies.EnemyEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -20,14 +19,14 @@ public class EnemyHandler {
|
||||
}
|
||||
|
||||
public void render(float delta) {
|
||||
EnemySpawner.getInstance().cycle(delta);
|
||||
SpawnerHandler.getInstance().cycle(delta);
|
||||
for (EnemyEntity enemy : enemies) enemy.cycle();
|
||||
}
|
||||
|
||||
public void cycle() {
|
||||
for (EnemyEntity enemy : enemies) {
|
||||
if (enemy.isMarkedToDestroy()) {
|
||||
Bugger.getInstance().getEntitiesToDestroy().add(enemy);
|
||||
CleanupHandler.getInstance().getEntitiesToDestroy().add(enemy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.lumijiez.bugger.handlers;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input;
|
||||
import org.lumijiez.bugger.Bugger;
|
||||
import org.lumijiez.bugger.entities.Player;
|
||||
import org.lumijiez.bugger.entities.weapons.Ray;
|
||||
|
||||
public class InputHandler {
|
||||
@@ -19,8 +20,8 @@ public class InputHandler {
|
||||
|
||||
public void handleInput() {
|
||||
if (Gdx.input.isButtonPressed(Input.Buttons.LEFT)) {
|
||||
Ray ray = Bugger.getInstance().getPlayer().shootArrow();
|
||||
Bugger.getInstance().getProjectiles().add(ray);
|
||||
Ray ray = Player.getInstance().shootArrow();
|
||||
ProjectileHandler.getInstance().getProjectiles().add(ray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,27 +7,27 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import org.lumijiez.bugger.Bugger;
|
||||
import org.lumijiez.bugger.entities.Player;
|
||||
|
||||
public class UIRenderer {
|
||||
public class InterfaceHandler {
|
||||
private final BitmapFont bitmapFont;
|
||||
private static UIRenderer instance;
|
||||
private static InterfaceHandler instance;
|
||||
|
||||
private UIRenderer() {
|
||||
private InterfaceHandler() {
|
||||
bitmapFont = new BitmapFont(Gdx.files.internal("EA.fnt"), Gdx.files.internal("EA.png"), false);
|
||||
}
|
||||
|
||||
public static UIRenderer getInstance() {
|
||||
public static InterfaceHandler getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new UIRenderer();
|
||||
instance = new InterfaceHandler();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void renderUI() {
|
||||
SpriteBatch uiBatch = Bugger.uiBatch;
|
||||
OrthographicCamera uiCam = Bugger.uiCam;
|
||||
OrthographicCamera uiCam = CameraHandler.getInstance().getUICamera();
|
||||
int kills = Bugger.kills;
|
||||
int enemies = EnemyHandler.getInstance().getEnemies().size();
|
||||
int projectiles = Bugger.getInstance().getProjectiles().size;
|
||||
int projectiles = ProjectileHandler.getInstance().getProjectiles().size;
|
||||
int bodies = Bugger.getInstance().getWorld().getBodyCount();
|
||||
uiBatch.begin();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.lumijiez.bugger.vfx;
|
||||
package org.lumijiez.bugger.handlers;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.g2d.ParticleEffect;
|
||||
@@ -7,12 +7,12 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import org.lumijiez.bugger.Bugger;
|
||||
|
||||
public class ParticleManager {
|
||||
private static ParticleManager instance;
|
||||
public class ParticleHandler {
|
||||
private static ParticleHandler instance;
|
||||
private final ParticleEffectPool particleEffectPool;
|
||||
private final Array<ParticleEffectPool.PooledEffect> activeEffects;
|
||||
|
||||
private ParticleManager() {
|
||||
private ParticleHandler() {
|
||||
ParticleEffect effect = new ParticleEffect();
|
||||
effect.load(Gdx.files.internal("particles/boom.p"), Gdx.files.internal("particles"));
|
||||
effect.scaleEffect(0.3f);
|
||||
@@ -20,9 +20,9 @@ public class ParticleManager {
|
||||
activeEffects = new Array<>();
|
||||
}
|
||||
|
||||
public static ParticleManager getInstance() {
|
||||
public static ParticleHandler getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new ParticleManager();
|
||||
instance = new ParticleHandler();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
@@ -59,4 +59,9 @@ public class ParticleManager {
|
||||
}
|
||||
activeEffects.clear();
|
||||
}
|
||||
|
||||
public void cycle(float delta) {
|
||||
update(delta);
|
||||
render(Bugger.spriteBatch);
|
||||
}
|
||||
}
|
||||
@@ -15,4 +15,19 @@ public class ProjectileHandler {
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void cycle(float delta) {
|
||||
for (Projectile arrow : projectiles) {
|
||||
if (!arrow.isMarkedToDestroy()) {
|
||||
arrow.update(delta);
|
||||
arrow.render();
|
||||
} else {
|
||||
CleanupHandler.getInstance().getEntitiesToDestroy().add(arrow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Array<Projectile> getProjectiles() {
|
||||
return projectiles;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
package org.lumijiez.bugger.vfx;
|
||||
package org.lumijiez.bugger.handlers;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
import org.lumijiez.bugger.Bugger;
|
||||
|
||||
public class SpaceBackground {
|
||||
public class SpaceVFXHandler {
|
||||
private static SpaceVFXHandler instance;
|
||||
|
||||
public static SpaceVFXHandler getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new SpaceVFXHandler();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private final Texture starTexture;
|
||||
private final Texture galaxyTexture;
|
||||
private final Texture nebulaTexture;
|
||||
@@ -20,7 +29,7 @@ public class SpaceBackground {
|
||||
private final int numNebulae = 20;
|
||||
private final float scaleFactor = 0.1f;
|
||||
|
||||
public SpaceBackground() {
|
||||
private SpaceVFXHandler() {
|
||||
starTexture = new Texture(Gdx.files.internal("images/star.png"));
|
||||
galaxyTexture = new Texture(Gdx.files.internal("images/galaxy.png"));
|
||||
nebulaTexture = new Texture(Gdx.files.internal("images/nebula.png"));
|
||||
@@ -51,8 +60,8 @@ public class SpaceBackground {
|
||||
public void render() {
|
||||
Bugger.spriteBatch.begin();
|
||||
|
||||
float cameraX = Bugger.cam.position.x;
|
||||
float cameraY = Bugger.cam.position.y;
|
||||
float cameraX = CameraHandler.getInstance().getCamera().position.x;
|
||||
float cameraY = CameraHandler.getInstance().getCamera().position.y;
|
||||
|
||||
drawStars(cameraX, cameraY);
|
||||
drawGalaxies(cameraX, cameraY);
|
||||
@@ -3,19 +3,20 @@ package org.lumijiez.bugger.handlers;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.physics.box2d.World;
|
||||
import org.lumijiez.bugger.Bugger;
|
||||
import org.lumijiez.bugger.entities.Player;
|
||||
import org.lumijiez.bugger.entities.enemies.Enemies;
|
||||
import org.lumijiez.bugger.factories.EnemyFactory;
|
||||
|
||||
public class EnemySpawner {
|
||||
private static EnemySpawner instance;
|
||||
public class SpawnerHandler {
|
||||
private static SpawnerHandler instance;
|
||||
private float enemySpawnTimer = 0f;
|
||||
private static final float ENEMY_SPAWN_INTERVAL = 0.5f;
|
||||
|
||||
private EnemySpawner() {}
|
||||
private SpawnerHandler() {}
|
||||
|
||||
public static EnemySpawner getInstance() {
|
||||
public static SpawnerHandler getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new EnemySpawner();
|
||||
instance = new SpawnerHandler();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
@@ -24,7 +25,7 @@ public class EnemySpawner {
|
||||
enemySpawnTimer += delta;
|
||||
if (enemySpawnTimer >= ENEMY_SPAWN_INTERVAL) {
|
||||
World world = Bugger.getInstance().getWorld();
|
||||
Vector2 playerPos = Bugger.getInstance().getPlayer().getPosition();
|
||||
Vector2 playerPos = Player.getInstance().getPosition();
|
||||
trySpawnRandom(world, playerPos);
|
||||
enemySpawnTimer = 0;
|
||||
}
|
||||
@@ -32,7 +33,7 @@ public class EnemySpawner {
|
||||
|
||||
public void spawn(Enemies enemy) {
|
||||
World world = Bugger.getInstance().getWorld();
|
||||
Vector2 playerPos = Bugger.getInstance().getPlayer().getPosition();
|
||||
Vector2 playerPos = Player.getInstance().getPosition();
|
||||
EnemyHandler.getInstance().getEnemies().add(EnemyFactory.createEnemy(enemy, world, playerPos));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user