feat: Implement powerup inventory UI and manager, introducing ghost and area freeze special tiles.

This commit is contained in:
Yogi Wiguna
2026-02-03 17:04:35 +08:00
parent 02d13d9ff5
commit 757051aca8
12 changed files with 297 additions and 69 deletions
+42 -2
View File
@@ -613,11 +613,20 @@ func _apply_tint_recursive(node: Node, color: Color):
# If color is WHITE (reset), clear the overlay
if color == Color.WHITE:
node.material_overlay = null
node.transparency = 0.0 # Reset
else:
# If color is Blue (frozen), make it semi-transparent overlay
mat.albedo_color = color
mat.albedo_color.a = 0.5 # Semi-transparent
mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
# Special Ghost Effect (Invisible Mode)
if color.a < 1.0:
mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
node.transparency = 0.5 # Make base mesh transparent too if possible, depending on material
else:
# Frozen
mat.albedo_color.a = 0.5 # Semi-transparent overlay
mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
node.material_overlay = mat
for child in node.get_children():
@@ -658,6 +667,37 @@ func apply_stagger(duration: float = 1.5):
else:
_apply_tint_recursive(self, Color.WHITE) # Remove tint
@rpc("any_peer", "call_local")
func apply_slow_effect(duration: float = 3.0):
# "area with blue like wall... Player who cross on that area will got slowed and freeze effect"
# Visual: Blue Tint
_apply_tint_recursive(self, Color(0.6, 0.8, 1.0)) # Icy Blue
# Logic: Slow Movement speed
if movement_manager:
# Use 0.2 multipliers to match "slowed" request (20% speed)
movement_manager.set_speed_multiplier(0.2)
print("Player %s is slowed for %.1f seconds" % [name, duration])
# Restore after duration
# Note: If they stand in the zone, this will be re-applied constantly, resetting the visual
await get_tree().create_timer(duration).timeout
# Only restore if not re-applied recently (simple check: if still tinted?)
# A better way is managing a "slow_timer" but for now let's just reset if timer expires.
# The persistent zone logic reapplies every frame, so we want this timer to be short
# OR we rely on the zone logic.
# The RPC call says "apply_slow_effect(0.5)", so it expires quickly.
if movement_manager:
movement_manager.set_speed_multiplier(1.0)
if immunity_timer > 0:
_apply_tint_recursive(self, Color(0.5, 1.0, 0.5))
else:
_apply_tint_recursive(self, Color.WHITE)
func playerboard_is_empty() -> bool:
for item in playerboard:
if item != -1: