feat: Implement powerup inventory UI and manager, introducing ghost and area freeze special tiles.
This commit is contained in:
+2
-1
@@ -29,6 +29,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://cupfmb5m15kmf" path="res://assets/graphics/touch_control/wall.png" id="27_yq6so"]
|
||||
[ext_resource type="Texture2D" uid="uid://3up2su2e0lfa" path="res://assets/graphics/touch_control/freeze_area.png" id="28_fv21b"]
|
||||
[ext_resource type="Texture2D" uid="uid://ckhdyxnho6sjp" path="res://assets/graphics/touch_control/spawn_tile.png" id="28_j8jky"]
|
||||
[ext_resource type="Texture2D" uid="uid://b2vhatfmufn3d" path="res://assets/graphics/touch_control/ghost.png" id="33_5q0nq"]
|
||||
[ext_resource type="Script" uid="uid://86ikh0wuqk7v" path="res://scripts/ui/powerup_inventory_ui.gd" id="powerup_ui_script"]
|
||||
[ext_resource type="Script" uid="uid://b54tfa0n6kogi" path="res://scripts/managers/touch_controls.gd" id="touch_manager"]
|
||||
[ext_resource type="Script" uid="uid://djiml4sh61dc1" path="res://scripts/ui/virtual_joystick.gd" id="virtual_joystick"]
|
||||
@@ -9881,7 +9882,7 @@ expand_icon = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
focus_mode = 0
|
||||
icon = ExtResource("27_dgi5k")
|
||||
icon = ExtResource("33_5q0nq")
|
||||
flat = true
|
||||
icon_alignment = 1
|
||||
expand_icon = true
|
||||
|
||||
+42
-2
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user