feat: Introduce Tekton roaming NPC with grid movement, player interaction, tile spawning, and visual effects.

This commit is contained in:
Yogi Wiguna
2026-03-13 10:07:17 +08:00
parent 74a81425c5
commit 200e198428
4 changed files with 48 additions and 31 deletions
+7 -7
View File
@@ -16,7 +16,7 @@ var safe_zone_centers: Array[Vector2i] = []
var safe_zone_spawned: bool = false
# Power-Up Tile Spawning
const POWERUP_TILES = [11, 12, 13, 14] # Speed, Freeze, Wall, Ghost
const POWERUP_TILES = [11, 14] # Speed, Ghost (Freeze and Wall excluded in this mode)
const POWERUP_SPAWN_COUNT: int = 5 # Number of power-up tiles to spawn
var powerups_spawned: bool = false
var stop_phase_occurred: bool = false
@@ -360,8 +360,8 @@ func _spawn_mission_tiles():
var base_tile = gridmap.get_cell_item(Vector3i(x, 0, z))
var current_item = gridmap.get_cell_item(Vector3i(x, 1, z))
# PROTECTED FLOOR CHECK: Don't spawn on walls or void
if base_tile in [TILE_OBSTACLE, -1] or current_item == TILE_OBSTACLE:
# PROTECTED FLOOR CHECK: Don't spawn on walls, void, or static powerup pods
if base_tile in [TILE_OBSTACLE, -1, TILE_LIGHTNING_STONE] or current_item == TILE_OBSTACLE:
continue
# Spawn tiles with 60% density
@@ -593,9 +593,9 @@ func _scatter_player_tiles(player_node: Node):
# Bounds check
if pos.x < 0 or pos.x >= gridmap.columns or pos.y < 0 or pos.y >= gridmap.rows:
continue
# Check floor is walkable (not void, not obstacle)
# Check floor is walkable (not void, not obstacle, not static powerup spawn)
var floor_tile = gridmap.get_cell_item(Vector3i(pos.x, 0, pos.y))
if floor_tile == -1 or floor_tile == TILE_OBSTACLE:
if floor_tile == -1 or floor_tile == TILE_OBSTACLE or floor_tile == TILE_LIGHTNING_STONE:
continue
# Check floor 1 is empty (no existing item)
var existing_item = gridmap.get_cell_item(Vector3i(pos.x, 1, pos.y))
@@ -750,8 +750,8 @@ func _spawn_powerup_tiles():
# Set Floor 0 beneath power-up to ID 15 (Ancient Lightning Stone)
gridmap.set_cell_item(Vector3i(pos.x, 0, pos.y), TILE_LIGHTNING_STONE)
# Cycle through the available power-up types
var tile_id = POWERUP_TILES[i % POWERUP_TILES.size()]
# Select a random power-up type (User Request: ensure all types can spawn)
var tile_id = POWERUP_TILES.pick_random()
# Place on Floor 1
gridmap.set_cell_item(Vector3i(pos.x, 1, pos.y), tile_id)