diff --git a/src/main/java/com/leewyatt/github/tank/TankApp.java b/src/main/java/com/leewyatt/github/tank/TankApp.java index d098d33..3475b0c 100644 --- a/src/main/java/com/leewyatt/github/tank/TankApp.java +++ b/src/main/java/com/leewyatt/github/tank/TankApp.java @@ -43,8 +43,6 @@ */ public class TankApp extends GameApplication { - public int initLevel = 1; - private Entity player; private PlayerComponent playerComponent; private Random random = new Random(); diff --git a/src/main/java/com/leewyatt/github/tank/ui/ConstructPane.java b/src/main/java/com/leewyatt/github/tank/ui/ConstructPane.java index 1c8322c..ea4a827 100644 --- a/src/main/java/com/leewyatt/github/tank/ui/ConstructPane.java +++ b/src/main/java/com/leewyatt/github/tank/ui/ConstructPane.java @@ -158,12 +158,16 @@ private StackPane initCenterPane() { private void saveConstructMap(boolean startGame) { List list = new ArrayList<>(text("levelStart.txt")); String grid = ""; + int y; for (int i = 0; i < map.length; i++) { for (int j = 0; j < map[i].length; j++) { if (map[j][i] != GameType.EMPTY) { + y = (i + 2) * CELL_SIZE; if (map[j][i] == GameType.BRICK) { grid = " gid=\"1\""; } else if (map[j][i] == GameType.SEA) { + //SEA ,不是object img 是普通的object 所以 i+1 + y = (i + 1) * CELL_SIZE; grid = ""; } else if (map[j][i] == GameType.SNOW) { grid = " gid=\"3\""; @@ -171,14 +175,14 @@ private void saveConstructMap(boolean startGame) { grid = " gid=\"4\""; } else if (map[j][i] == GameType.GREENS) { grid = " gid=\"5\""; - ; } //因为有边框,所以x方向是 j+1. //object 里的图像对象在Tiled软件里记录是左下角的坐标,而不是左上角的坐标,所以 i+1+1 + list.add(String.format( " ", idIndex++, map[j][i].toString().toLowerCase(Locale.ROOT), grid, - (j + 1) * CELL_SIZE, (i + 2) * CELL_SIZE)); + (j + 1) * CELL_SIZE, y)); } } }