feat: Implement core game managers, player movement logic, and initial UI scenes.

This commit is contained in:
2025-12-27 05:45:57 +08:00
parent 6870016ba6
commit c5e9d073fa
23 changed files with 1456 additions and 97 deletions
+21 -1
View File
@@ -6,6 +6,7 @@ const MAX_POINTS: int = 12
const POINTS_PER_BAR: int = 4
const MAX_BARS: int = 4
const HOLO_PICKUPS_PER_BAR: int = 4
const SPECIAL_COOLDOWN: float = 4.0 # 4 second cooldown
var player: Node3D
var enhanced_gridmap: Node
@@ -13,6 +14,7 @@ var enhanced_gridmap: Node
# Power-up state
var current_points: int = 0
var holo_pickup_count: int = 0
var special_cooldown_timer: float = 0.0 # Current cooldown remaining
signal points_changed(current: int, max_points: int)
signal bar_filled()
@@ -21,6 +23,12 @@ signal effect_used()
func initialize(p_player: Node3D, p_gridmap: Node):
player = p_player
enhanced_gridmap = p_gridmap
set_process(true)
func _process(delta):
# Update cooldown timer
if special_cooldown_timer > 0:
special_cooldown_timer -= delta
# =============================================================================
# Holo Tile Pickup
@@ -79,17 +87,29 @@ func use_special_effect():
player.rpc("display_message", "Not enough power-up!", 3)
return false
# Check cooldown
if special_cooldown_timer > 0:
player.rpc("display_message", "Special on cooldown! (%.1fs)" % special_cooldown_timer, 3)
return false
# Consume 1 bar
current_points -= POINTS_PER_BAR
emit_signal("effect_used")
emit_signal("points_changed", current_points, MAX_POINTS)
# Start cooldown
special_cooldown_timer = SPECIAL_COOLDOWN
# Play special animation (backflip)
if player.has_method("play_special_animation"):
player.play_special_animation()
# Trigger random special effect via SpecialTilesManager
var special_tiles_manager = player.get_node_or_null("SpecialTilesManager")
if special_tiles_manager:
special_tiles_manager.trigger_random_effect()
print("[PowerUp] Player %s used special effect! Remaining: %d/%d points" % [player.name, current_points, MAX_POINTS])
print("[PowerUp] Player %s used special effect! Remaining: %d/%d points, Cooldown: %.1fs" % [player.name, current_points, MAX_POINTS, SPECIAL_COOLDOWN])
if player.is_multiplayer_authority():
rpc("sync_points", current_points)