feat: implement obstacle manager for randomized static wall spawning, integrate into main scene, and add stop-n-go manager.

This commit is contained in:
Yogi Wiguna
2026-02-25 10:54:55 +08:00
parent e31973dfab
commit 040e6e53ce
3 changed files with 166 additions and 40 deletions
+4 -40
View File
@@ -286,52 +286,16 @@ func _apply_arena_setup():
for z in range(gridmap.rows):
gridmap.set_cell_item(Vector3i(x, 0, z), tile_id)
# --- SPECIFIC OBSTACLES (Black Walls) ---
# Note: Specific obstacles removed as per user request to replace with random ones.
# MISSION TILES: Moved to start_game_mode() to ensure they spawn AFTER walls.
# Left Obstacles (Column 4)
# Top Vertical Bar
for z in range(0, 4): # z=0, 1, 2, 3
gridmap.set_cell_item(Vector3i(4, 0, z), TILE_OBSTACLE)
# Bottom Vertical Bar
for z in range(6, 10): # z=6, 7, 8, 9
gridmap.set_cell_item(Vector3i(4, 0, z), TILE_OBSTACLE)
# Center Obstacles (Column 11 area)
# Top Middle Vertical Bar (Offset slightly down)
for z in range(1, 5): # z=1, 2, 3, 4
gridmap.set_cell_item(Vector3i(11, 0, z), TILE_OBSTACLE)
# Bottom Middle L-Shape (Vertical + Horizontal hook)
for z in range(6, 9): # z=6, 7, 8 (Vertical part)
gridmap.set_cell_item(Vector3i(11, 0, z), TILE_OBSTACLE)
# Horizontal part of L (at z=6 to right?) - Image looks like inverted L or T?
# Let's assume right hook at top of bottom part
gridmap.set_cell_item(Vector3i(12, 0, 6), TILE_OBSTACLE)
# Right Obstacles (Column 18 area)
# Top Right L-Shape (Horizontal hook + Vertical down)
# Vertical
for z in range(0, 3): # z=0, 1, 2
gridmap.set_cell_item(Vector3i(18, 0, z), TILE_OBSTACLE)
# Horizontal hook to right
gridmap.set_cell_item(Vector3i(19, 0, 2), TILE_OBSTACLE)
gridmap.set_cell_item(Vector3i(20, 0, 2), TILE_OBSTACLE)
# Bottom Right Vertical Bar
for z in range(5, 9): # z=5, 6, 7, 8
gridmap.set_cell_item(Vector3i(18, 0, z), TILE_OBSTACLE)
gridmap.update_grid_data()
gridmap.initialize_astar()
# Spawn tiles for missions
func setup_mission_tiles():
"""Public wrapper to trigger mission tile spawning before game start."""
if multiplayer.is_server():
_spawn_mission_tiles()
# Client already constructs the base arena locally via _apply_arena_setup()
# So no need to blast huge 5KB arrays across the network.
# For any specifically spawned tiles (like missions), they are sent individually
# by sync_grid_item inside _spawn_mission_tiles.
func _spawn_mission_tiles():
var gridmap = get_parent().get_node_or_null("EnhancedGridMap")