diff --git a/public/assets/maps/01_first_steps.png b/public/assets/maps/01_first_steps.png
index 4cedff4..0d50143 100644
Binary files a/public/assets/maps/01_first_steps.png and b/public/assets/maps/01_first_steps.png differ
diff --git a/public/assets/maps/02_the_turn.png b/public/assets/maps/02_the_turn.png
index cd12c7c..cd31cf8 100644
Binary files a/public/assets/maps/02_the_turn.png and b/public/assets/maps/02_the_turn.png differ
diff --git a/public/assets/maps/03_fork_in_the_road.png b/public/assets/maps/03_fork_in_the_road.png
index 46a7266..591e55f 100644
Binary files a/public/assets/maps/03_fork_in_the_road.png and b/public/assets/maps/03_fork_in_the_road.png differ
diff --git a/public/assets/maps/04_crossroads.png b/public/assets/maps/04_crossroads.png
index d7d2993..9b05fe7 100644
Binary files a/public/assets/maps/04_crossroads.png and b/public/assets/maps/04_crossroads.png differ
diff --git a/public/assets/maps/05_the_maze.png b/public/assets/maps/05_the_maze.png
index 63db43b..bbbc554 100644
Binary files a/public/assets/maps/05_the_maze.png and b/public/assets/maps/05_the_maze.png differ
diff --git a/public/assets/maps/06_multiple_fronts.png b/public/assets/maps/06_multiple_fronts.png
index bb81ed9..851333f 100644
Binary files a/public/assets/maps/06_multiple_fronts.png and b/public/assets/maps/06_multiple_fronts.png differ
diff --git a/public/assets/missions/02_the_turn.json b/public/assets/missions/02_the_turn.json
index 6e4e207..19fcf1a 100644
--- a/public/assets/missions/02_the_turn.json
+++ b/public/assets/missions/02_the_turn.json
@@ -28,39 +28,42 @@
],
"paths": [
[
- [4, 0],
- [4, 1],
- [4, 2],
- [4, 3],
+ [0, 4],
+ [1, 4],
+ [2, 4],
+ [3, 4],
[4, 4],
- [4, 5],
- [4, 6],
- [4, 7],
- [4, 8],
- [5, 8],
- [6, 8],
- [7, 8],
- [8, 8],
- [9, 8],
- [10, 8],
+ [5, 4],
+ [6, 4],
+ [7, 4],
+ [8, 4],
+ [9, 4],
+ [10, 4],
+ [11, 4],
+ [12, 4],
+ [11, 6],
+ [11, 7],
[11, 8],
- [12, 8],
- [12, 9],
- [12, 10],
- [12, 11],
- [12, 12],
- [12, 13],
- [12, 14],
- [12, 15],
- [12, 16],
- [12, 17],
- [12, 18],
- [12, 19],
- [12, 20],
- [12, 21],
- [12, 22],
- [12, 23],
- [12, 24]
+ [11, 9],
+ [11, 10],
+ [11, 11],
+ [2, 10],
+ [2, 11],
+ [2, 12],
+ [2, 13],
+ [2, 14],
+ [19, 14],
+ [20, 14],
+ [20, 13],
+ [20, 12],
+ [20, 11],
+ [20, 10],
+ [20, 9],
+ [20, 8],
+ [20, 7],
+ [20, 6],
+ [20, 5],
+ [20, 4]
]
]
},
diff --git a/public/assets/missions/mission_01.json b/public/assets/missions/mission_01.json
index 13567fd..a997e15 100644
--- a/public/assets/missions/mission_01.json
+++ b/public/assets/missions/mission_01.json
@@ -28,68 +28,68 @@
],
"paths": [
[
- [4, 0],
- [4, 1],
- [4, 2],
- [4, 3],
+ [0, 4],
+ [1, 4],
+ [2, 4],
+ [3, 4],
[4, 4],
- [4, 5],
- [4, 6],
- [4, 7],
- [4, 8],
- [4, 9],
- [4, 10],
- [4, 11],
- [4, 12],
- [5, 12],
- [6, 12],
- [7, 12],
- [8, 12],
- [9, 12],
- [10, 12],
- [10, 11],
- [10, 10],
- [10, 9],
- [10, 8],
- [10, 7],
- [10, 6],
- [10, 5],
+ [5, 4],
+ [6, 4],
+ [7, 4],
+ [8, 4],
+ [9, 4],
[10, 4],
- [10, 3],
- [11, 3],
- [12, 3],
- [13, 3],
- [14, 3],
- [14, 4],
- [14, 5],
- [14, 6],
- [14, 7],
- [14, 8],
- [14, 9],
- [14, 10],
- [14, 11],
- [14, 12],
- [14, 13],
+ [11, 4],
+ [12, 4],
+ [12, 5],
+ [12, 6],
+ [12, 7],
+ [12, 8],
+ [12, 9],
+ [12, 10],
+ [11, 10],
+ [10, 10],
+ [9, 10],
+ [8, 10],
+ [7, 10],
+ [6, 10],
+ [5, 10],
+ [4, 10],
+ [3, 10],
+ [3, 11],
+ [3, 12],
+ [3, 13],
+ [3, 14],
+ [4, 14],
+ [5, 14],
+ [6, 14],
+ [7, 14],
+ [8, 14],
+ [9, 14],
+ [10, 14],
+ [11, 14],
+ [12, 14],
+ [13, 14],
[14, 14],
- [14, 15],
- [14, 16],
- [14, 17],
- [14, 18],
- [14, 19],
- [14, 20],
- [13, 20],
- [12, 20],
- [11, 20],
- [10, 20],
- [9, 20],
- [8, 20],
- [7, 20],
- [6, 20],
- [5, 20],
- [5, 21],
- [5, 22],
- [5, 23],
- [5, 24]
+ [15, 14],
+ [16, 14],
+ [17, 14],
+ [18, 14],
+ [19, 14],
+ [20, 14],
+ [20, 13],
+ [20, 12],
+ [20, 11],
+ [20, 10],
+ [20, 9],
+ [20, 8],
+ [20, 7],
+ [20, 6],
+ [20, 5],
+ [21, 5],
+ [22, 5],
+ [23, 5],
+ [24, 5]
]
]
},
diff --git a/public/maps.tiled-session b/public/maps.tiled-session
index 41809c3..1407999 100644
--- a/public/maps.tiled-session
+++ b/public/maps.tiled-session
@@ -3,10 +3,10 @@
"height": 4300,
"width": 2
},
- "activeFile": "tiled/02_the_turn.tmx",
+ "activeFile": "tiled/Mission01.tmx",
"expandedProjectPaths": [
- "assets/missions",
"tiled",
+ "assets/missions",
"."
],
"file.lastUsedOpenFilter": "All Files (*)",
@@ -43,76 +43,102 @@
}
},
"Tileset.tsx": {
- "scaleInDock": 0.5,
+ "scaleInDock": 0.75,
"scaleInEditor": 1
},
- "tiled/01_first_steps.tmx": {
- "scale": 1.6494375,
+ "tiled/01_first_steps..tmx": {
+ "scale": 1,
"selectedLayer": 0,
"viewCenter": {
- "x": 799.9696866355956,
- "y": 544.1248910613466
+ "x": 975,
+ "y": 640.5
+ }
+ },
+ "tiled/01_first_steps.tmx": {
+ "scale": 0.75,
+ "selectedLayer": 0,
+ "viewCenter": {
+ "x": 800.6666666666665,
+ "y": 543.3333333333333
}
},
"tiled/02_the_turn.tmx": {
- "scale": 1.6494375,
+ "scale": 1,
"selectedLayer": 0,
"viewCenter": {
- "x": 799.9696866355956,
- "y": 544.1248910613466
+ "x": 800.5,
+ "y": 543.5
}
},
"tiled/03_fork_in_the_road.tmx": {
- "scale": 1.6494375,
+ "scale": 1,
"selectedLayer": 0,
"viewCenter": {
- "x": 799.9696866355956,
- "y": 544.1248910613466
+ "x": 800.5,
+ "y": 543.5
}
},
"tiled/04_crossroads.tmx": {
- "scale": 1.6494375,
+ "scale": 1,
"selectedLayer": 0,
"viewCenter": {
- "x": 799.9696866355956,
- "y": 544.1248910613466
+ "x": 800.5,
+ "y": 543.5
}
},
"tiled/05_the_maze.tmx": {
"scale": 1.6494375,
"selectedLayer": 0,
"viewCenter": {
- "x": 799.9696866355956,
- "y": 544.1248910613466
+ "x": 799.9696866355955,
+ "y": 544.1248910613467
+ }
+ },
+ "tiled/06_multiple_fronts.tmx": {
+ "scale": 1.6494375,
+ "selectedLayer": 0,
+ "viewCenter": {
+ "x": 799.9696866355955,
+ "y": 544.1248910613467
}
},
"tiled/Mission01.tmx": {
- "scale": 0.5,
+ "scale": 1,
"selectedLayer": 0,
"viewCenter": {
- "x": 799,
- "y": 543
+ "x": 833,
+ "y": 628.5
}
}
},
+ "last.exportedFilePath": "C:/Work/Projects/Matej/towerdefense/public/tiled",
"last.externalTilesetPath": "/home/koneko/Programing/js/towerdefense/public",
"map.height": 17,
- "map.lastUsedFormat": "tmx",
+ "map.lastUsedExportFilter": "All Files (*)",
+ "map.lastUsedFormat": "json",
"map.tileHeight": 64,
"map.tileWidth": 64,
"map.width": 25,
"openFiles": [
- "Mission011.tmx",
- "tiled/Mission01.tmx",
- "tiled/02_the_turn.tmx",
- "tiled/01_first_steps.tmx"
- ],
- "project": "maps.tiled-project",
- "recentFiles": [
- "Mission011.tmx",
+ "tiled/04_crossroads.tmx",
+ "tiled/05_the_maze.tmx",
"tiled/Mission01.tmx",
"tiled/01_first_steps.tmx",
"tiled/02_the_turn.tmx",
+ "tiled/03_fork_in_the_road.tmx",
+ "tiled/06_multiple_fronts.tmx"
+ ],
+ "project": "maps.tiled-project",
+ "recentFiles": [
+ "tiled/04_crossroads.tmx",
+ "tiled/05_the_maze.tmx",
+ "tiled/06_multiple_fronts.tmx",
+ "tiled/03_fork_in_the_road.tmx",
+ "tiled/02_the_turn.tmx",
+ "tiled/01_first_steps.tmx",
+ "tiled/Mission01.tmx",
+ "tiled/01_first_steps..tmx",
+ "Mission011.tmx",
"Tileset.tsx",
"Mission01.tmx",
"C:/home/koneko/dumping/tiles/TiledTDThree64.tmx"
diff --git a/public/tiled/01_first_steps.tmx b/public/tiled/01_first_steps.tmx
index fd54ac7..be53f3c 100644
--- a/public/tiled/01_first_steps.tmx
+++ b/public/tiled/01_first_steps.tmx
@@ -1,9 +1,8 @@
\ No newline at end of file
+
+
+
diff --git a/public/tiled/02_the_turn.tmx b/public/tiled/02_the_turn.tmx
index bc35bf9..17914fa 100644
--- a/public/tiled/02_the_turn.tmx
+++ b/public/tiled/02_the_turn.tmx
@@ -1,25 +1,25 @@
\ No newline at end of file
+
+
+
diff --git a/public/tiled/03_fork_in_the_road.tmx b/public/tiled/03_fork_in_the_road.tmx
index 330bcc7..b328de8 100644
--- a/public/tiled/03_fork_in_the_road.tmx
+++ b/public/tiled/03_fork_in_the_road.tmx
@@ -1,25 +1,25 @@
\ No newline at end of file
+
+
+
diff --git a/public/tiled/04_crossroads.tmx b/public/tiled/04_crossroads.tmx
index e7082d2..6269a07 100644
--- a/public/tiled/04_crossroads.tmx
+++ b/public/tiled/04_crossroads.tmx
@@ -1,25 +1,25 @@
\ No newline at end of file
+15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
+
+
+
diff --git a/public/tiled/05_the_maze.tmx b/public/tiled/05_the_maze.tmx
index e5e0771..b13c7a8 100644
--- a/public/tiled/05_the_maze.tmx
+++ b/public/tiled/05_the_maze.tmx
@@ -1,25 +1,25 @@
\ No newline at end of file
+
+
+
+4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,15,15,15,15,15,15,
+18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,19,15,15,15,15,15,15,
+32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,7,18,19,15,15,15,15,15,15,
+15,3,4,4,4,4,4,4,4,4,4,4,4,4,4,5,17,18,19,15,15,15,15,15,15,
+15,17,18,18,18,18,18,18,18,18,18,18,18,18,18,19,17,18,19,15,15,15,15,15,15,
+15,17,18,6,32,32,32,32,32,32,32,32,32,7,18,19,17,18,19,15,15,15,15,15,15,
+15,17,18,19,15,15,15,15,15,15,15,15,15,17,18,20,21,18,20,4,4,4,4,5,15,
+15,17,18,19,15,15,15,15,15,15,15,15,15,17,18,18,18,18,18,18,18,18,18,20,4,
+15,17,18,19,3,4,4,4,4,4,4,5,15,17,18,6,7,18,6,32,32,7,18,18,18,
+15,17,18,19,17,18,18,18,18,18,18,19,15,17,18,19,17,18,19,15,15,31,32,32,32,
+15,17,18,19,17,18,6,32,32,7,18,20,4,21,18,19,17,18,19,15,15,15,15,15,15,
+15,17,18,19,17,18,19,15,15,17,18,18,18,18,18,19,17,18,19,15,15,15,15,15,15,
+15,17,18,19,17,18,19,15,15,31,32,32,32,32,32,33,17,18,19,15,15,15,15,15,15,
+15,17,18,19,17,18,20,4,4,4,4,4,4,4,4,4,21,18,19,15,15,15,15,15,15,
+4,21,18,19,17,18,18,18,18,18,18,18,18,18,18,18,18,18,19,15,15,15,15,15,15,
+18,18,18,19,31,32,32,32,32,32,32,32,32,32,32,32,32,32,33,15,15,15,15,15,15,
+32,32,32,33,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
+
+
+
diff --git a/public/tiled/06_multiple_fronts.tmx b/public/tiled/06_multiple_fronts.tmx
index 051a5d0..f93c5c1 100644
--- a/public/tiled/06_multiple_fronts.tmx
+++ b/public/tiled/06_multiple_fronts.tmx
@@ -1,25 +1,25 @@
\ No newline at end of file
+4,4,4,5,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+18,18,18,19,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+32,7,18,19,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+15,17,18,19,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+15,17,18,19,15,15,15,15,15,15,3,4,4,4,4,4,4,4,5,15,15,15,15,15,15,
+15,17,18,19,15,15,15,15,15,15,17,18,18,18,18,18,18,18,20,4,4,4,4,4,4,
+15,17,18,20,4,4,4,4,4,4,21,18,6,32,32,32,7,18,18,18,18,18,18,18,18,
+15,17,18,18,18,18,18,18,18,18,18,18,19,15,15,15,31,32,32,32,32,32,32,32,32,
+15,31,32,32,32,32,32,32,32,32,32,32,33,15,15,15,15,15,15,15,15,15,15,15,15
+
+
+
diff --git a/src/classes/Definitions.ts b/src/classes/Definitions.ts
index 3026d7e..0d44771 100644
--- a/src/classes/Definitions.ts
+++ b/src/classes/Definitions.ts
@@ -92,7 +92,7 @@ export type GenericGemImprovement = {
gemValueUp: number;
};
-export type PathDefinition = [[row: number, column: number]];
+export type PathDefinition = [[column: number, row: number]];
export enum TerrainType {
Restricted = 0,
diff --git a/src/classes/game/Creep.ts b/src/classes/game/Creep.ts
index 37e75a0..fa17654 100644
--- a/src/classes/game/Creep.ts
+++ b/src/classes/game/Creep.ts
@@ -49,8 +49,8 @@ export default class Creep extends GameObject {
this.maxHealth = this.stats.health;
this.path = path;
// Added + 32 to center them.
- this.x = path[0][1] * Engine.GridCellSize + Engine.GridCellSize / 2;
- this.y = path[0][0] * Engine.GridCellSize + Engine.GridCellSize / 2;
+ this.x = path[0][0] * Engine.GridCellSize + Engine.GridCellSize / 2;
+ this.y = path[0][1] * Engine.GridCellSize + Engine.GridCellSize / 2;
// TODO: Unsubscribe from events once the scene is destroyed
Engine.GameScene.events.on(CreepEvents.TakenDamage, (creepID, damage) => {
if (creepID != this.id) return;
@@ -95,10 +95,10 @@ export default class Creep extends GameObject {
const targetCell = this.path[this.pathIndex + 1];
// Added + 32 for centering.
- const targetX = targetCell[1] * Engine.GridCellSize + Engine.GridCellSize / 2;
- const targetY = targetCell[0] * Engine.GridCellSize + Engine.GridCellSize / 2;
- const directionX = targetCell[1] - currentCell[1];
- const directionY = targetCell[0] - currentCell[0];
+ const targetX = targetCell[0] * Engine.GridCellSize + Engine.GridCellSize / 2;
+ const targetY = targetCell[1] * Engine.GridCellSize + Engine.GridCellSize / 2;
+ const directionX = targetCell[0] - currentCell[0];
+ const directionY = targetCell[1] - currentCell[1];
if (directionX > 0) {
// Going right
if (this.direction != 1) {
diff --git a/src/classes/game/Grid.ts b/src/classes/game/Grid.ts
index f0246e8..d7b8a0c 100644
--- a/src/classes/game/Grid.ts
+++ b/src/classes/game/Grid.ts
@@ -133,7 +133,7 @@ export class Grid extends GameObject {
for (let x = 0; x < this.gameMap.rows; x++) {
let type = this.gameMap.cells[x][y];
if (!type) type = 1;
- const isPath = this.gameMap.paths.some((path) => path.some((p) => p[0] === x && p[1] === y));
+ const isPath = this.gameMap.paths.some((path) => path.some((p) => p[1] === x && p[0] === y));
if (isPath) type = TerrainType.Path;
let cell = new Cell(type, x, y, isPath);
this.cells.push(cell);
diff --git a/src/classes/game/WaveManager.ts b/src/classes/game/WaveManager.ts
index 6bc94b6..0adbf9d 100644
--- a/src/classes/game/WaveManager.ts
+++ b/src/classes/game/WaveManager.ts
@@ -61,7 +61,7 @@ export default class WaveManager extends GameObject {
console.log('Wave manager creep spawned, ', creep, this.ticks);
if (!this.finished && this.creeps.every((creep) => creep.spawned)) {
this.finished = true;
- console.log('wave maanger finisehd');
+ console.log('wave manager finished');
this.events.emit(WaveManagerEvents.Finished);
}
} else if (creep.spawned) {