Spaces:
Running
Running
feat(path): switch to single Z-shaped path with inset start/end; disable multi-path lanes; update docs
Browse files- README.md +3 -1
- src/config/gameConfig.js +18 -46
README.md
CHANGED
|
@@ -8,4 +8,6 @@ pinned: false
|
|
| 8 |
short_description: A tower defense game made with GPT-5
|
| 9 |
---
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
|
|
| 8 |
short_description: A tower defense game made with GPT-5
|
| 9 |
---
|
| 10 |
|
| 11 |
+
Single-path Z-shaped map: enemies now follow one zigzagging road from the top edge to the bottom edge. The previous 3-lane branching feature has been disabled.
|
| 12 |
+
|
| 13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
src/config/gameConfig.js
CHANGED
|
@@ -159,56 +159,28 @@ export function getWaveParams(n) {
|
|
| 159 |
export const GROUND_SIZE = 72; // slightly larger to allow wider spacing
|
| 160 |
export const GRID_CELL_SIZE = 2;
|
| 161 |
|
| 162 |
-
//
|
| 163 |
-
//
|
| 164 |
-
// from edges to keep tower placement meaningful across the board.
|
| 165 |
const HALF = GROUND_SIZE / 2;
|
| 166 |
-
const PATH_MARGIN = 4 * GRID_CELL_SIZE; // 4 squares (8 units)
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
const
|
| 170 |
-
|
| 171 |
-
const
|
| 172 |
-
|
|
|
|
|
|
|
|
|
|
| 173 |
export const PATH_POINTS = [
|
| 174 |
-
//
|
| 175 |
-
new THREE.Vector3(
|
| 176 |
-
new THREE.Vector3(
|
| 177 |
-
|
| 178 |
-
new THREE.Vector3(0, 0, REJOIN_Z),
|
| 179 |
-
// Exit to bottom edge
|
| 180 |
-
new THREE.Vector3(0, 0, -HALF), // (0, -36)
|
| 181 |
];
|
| 182 |
|
| 183 |
-
//
|
| 184 |
-
|
| 185 |
-
export const PATHS = [
|
| 186 |
-
// Left lane: go left at split, travel down, then rejoin center
|
| 187 |
-
[
|
| 188 |
-
new THREE.Vector3(0, 0, HALF), // start top center
|
| 189 |
-
new THREE.Vector3(0, 0, SPLIT_Z), // approach split
|
| 190 |
-
new THREE.Vector3(-LANE_OFFSET_X, 0, SPLIT_Z), // branch left
|
| 191 |
-
new THREE.Vector3(-LANE_OFFSET_X, 0, REJOIN_Z), // long split zone
|
| 192 |
-
new THREE.Vector3(0, 0, REJOIN_Z), // rejoin center
|
| 193 |
-
new THREE.Vector3(0, 0, -HALF), // exit bottom center
|
| 194 |
-
],
|
| 195 |
-
// Middle lane: continue straight through the split
|
| 196 |
-
[
|
| 197 |
-
new THREE.Vector3(0, 0, HALF),
|
| 198 |
-
new THREE.Vector3(0, 0, SPLIT_Z),
|
| 199 |
-
new THREE.Vector3(0, 0, REJOIN_Z),
|
| 200 |
-
new THREE.Vector3(0, 0, -HALF),
|
| 201 |
-
],
|
| 202 |
-
// Right lane: go right at split, travel down, then rejoin center
|
| 203 |
-
[
|
| 204 |
-
new THREE.Vector3(0, 0, HALF),
|
| 205 |
-
new THREE.Vector3(0, 0, SPLIT_Z),
|
| 206 |
-
new THREE.Vector3(LANE_OFFSET_X, 0, SPLIT_Z), // branch right
|
| 207 |
-
new THREE.Vector3(LANE_OFFSET_X, 0, REJOIN_Z), // long split zone
|
| 208 |
-
new THREE.Vector3(0, 0, REJOIN_Z), // rejoin center
|
| 209 |
-
new THREE.Vector3(0, 0, -HALF),
|
| 210 |
-
],
|
| 211 |
-
];
|
| 212 |
|
| 213 |
// Visual settings
|
| 214 |
export const SCENE_BACKGROUND = 0x202432;
|
|
|
|
| 159 |
export const GROUND_SIZE = 72; // slightly larger to allow wider spacing
|
| 160 |
export const GRID_CELL_SIZE = 2;
|
| 161 |
|
| 162 |
+
// Single-path Z-shaped waypoints from top to bottom.
|
| 163 |
+
// Snakes left↔right across the board with vertical steps.
|
|
|
|
| 164 |
const HALF = GROUND_SIZE / 2;
|
| 165 |
+
const PATH_MARGIN = 4 * GRID_CELL_SIZE; // 4 squares (8 units) from edges
|
| 166 |
+
const LEFT_X = -HALF + PATH_MARGIN;
|
| 167 |
+
const RIGHT_X = HALF - PATH_MARGIN;
|
| 168 |
+
const MID_Z = 0; // middle of the board
|
| 169 |
+
// Inset start/end vertical lines a bit further from side edges
|
| 170 |
+
const EDGE_INSET = 5 * GRID_CELL_SIZE; // 5 cells inward (10 units)
|
| 171 |
+
const LEFT_X_IN = LEFT_X + EDGE_INSET;
|
| 172 |
+
const RIGHT_X_IN = RIGHT_X - EDGE_INSET;
|
| 173 |
+
|
| 174 |
+
// Exactly 3 turns: right at top, down at top-right, left at mid, down at mid-left
|
| 175 |
export const PATH_POINTS = [
|
| 176 |
+
new THREE.Vector3(RIGHT_X_IN, 0, HALF), // start top-right, straight down (inset)
|
| 177 |
+
new THREE.Vector3(RIGHT_X_IN, 0, MID_Z), // vertical start segment
|
| 178 |
+
new THREE.Vector3(LEFT_X_IN, 0, MID_Z), // horizontal across the middle
|
| 179 |
+
new THREE.Vector3(LEFT_X_IN, 0, -HALF), // vertical to bottom exit (inset)
|
|
|
|
|
|
|
|
|
|
| 180 |
];
|
| 181 |
|
| 182 |
+
// Disable multi-path branching; keep empty to fallback everywhere to PATH_POINTS
|
| 183 |
+
export const PATHS = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
|
| 185 |
// Visual settings
|
| 186 |
export const SCENE_BACKGROUND = 0x202432;
|