diff --git a/core/src/com/me/pacman/entity/MovableEntity.java b/core/src/com/me/pacman/entity/MovableEntity.java index ff385a7..1d05bc7 100644 --- a/core/src/com/me/pacman/entity/MovableEntity.java +++ b/core/src/com/me/pacman/entity/MovableEntity.java @@ -1,6 +1,6 @@ package com.me.pacman.entity; -import com.me.pacman.level.LevelComponent; +import com.me.pacman.level.LevelTile; import com.me.pacman.state.LevelState; public abstract class MovableEntity extends Entity { @@ -30,7 +30,7 @@ public abstract class MovableEntity extends Entity { } if (nextDirection != null) { - LevelComponent nextComponent; + LevelTile nextComponent; boolean turned = false; switch (nextDirection) { case NORTH: diff --git a/core/src/com/me/pacman/level/Level.java b/core/src/com/me/pacman/level/Level.java index 124794e..044cad6 100644 --- a/core/src/com/me/pacman/level/Level.java +++ b/core/src/com/me/pacman/level/Level.java @@ -1,6 +1,5 @@ package com.me.pacman.level; -import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.me.pacman.PacDude; @@ -12,7 +11,7 @@ public class Level { private TextureRegion powerPellet; // Grid of components, [rows][columns] - public LevelComponent[][] components; + public LevelTile[][] components; public Level(PacDude game, String level) { @@ -25,23 +24,23 @@ public class Level { components = loader.loadLevel(); } - public LevelComponent getComponent(int x, int y) { + public LevelTile getComponent(int x, int y) { return components[y][x]; } - public LevelComponent getComponent(float x, float y) { + public LevelTile getComponent(float x, float y) { return getComponent((int) x, (int) y); } - public void setComponent(int x, int y, LevelComponent component) { + public void setComponent(int x, int y, LevelTile component) { components[y][x] = component; } public void render(int offsetX, int offsetY) { for (int i = 0; i < components.length; i++) { - LevelComponent[] row = components[i]; + LevelTile[] row = components[i]; for (int j = 0; j < row.length; j++) { - LevelComponent component = row[j]; + LevelTile component = row[j]; TextureRegion sprite; switch (component) { case PELLET: diff --git a/core/src/com/me/pacman/level/LevelLoader.java b/core/src/com/me/pacman/level/LevelLoader.java index 0e37991..1e19733 100644 --- a/core/src/com/me/pacman/level/LevelLoader.java +++ b/core/src/com/me/pacman/level/LevelLoader.java @@ -11,11 +11,11 @@ public class LevelLoader { levelFile = Gdx.files.internal("data/" + level + ".txt"); } - public LevelComponent[][] loadLevel() { + public LevelTile[][] loadLevel() { String levelData = levelFile.readString(); String[] lines = levelData.split("\n"); int rows = lines.length; - LevelComponent[][] components = new LevelComponent[rows][lines[0].length()]; + LevelTile[][] components = new LevelTile[rows][lines[0].length()]; for (int i = 0; i < rows; i++) { String line = lines[i]; @@ -25,25 +25,25 @@ public class LevelLoader { int row = rows - i - 1; switch(c) { case '*': - components[row][j] = LevelComponent.PELLET; + components[row][j] = LevelTile.PELLET; break; case '%': - components[row][j] = LevelComponent.POWER_PELLET; + components[row][j] = LevelTile.POWER_PELLET; break; case '#': - components[row][j] = LevelComponent.WALL; + components[row][j] = LevelTile.WALL; break; case '^': - components[row][j] = LevelComponent.GHOST_CHAMBER; + components[row][j] = LevelTile.GHOST_CHAMBER; break; case '_': - components[row][j] = LevelComponent.GHOST_GATE; + components[row][j] = LevelTile.GHOST_GATE; break; case '-': - components[row][j] = LevelComponent.HALLWAY; + components[row][j] = LevelTile.HALLWAY; break; default: - components[row][j] = LevelComponent.EMPTY; + components[row][j] = LevelTile.EMPTY; } } } diff --git a/core/src/com/me/pacman/level/LevelComponent.java b/core/src/com/me/pacman/level/LevelTile.java similarity index 89% rename from core/src/com/me/pacman/level/LevelComponent.java rename to core/src/com/me/pacman/level/LevelTile.java index 1c8aeb4..5c4b190 100644 --- a/core/src/com/me/pacman/level/LevelComponent.java +++ b/core/src/com/me/pacman/level/LevelTile.java @@ -1,6 +1,6 @@ package com.me.pacman.level; -public enum LevelComponent { +public enum LevelTile { PELLET, POWER_PELLET,