feat: Add core game scene with manager initialization, a dynamic message bar, scarcity-based tile respawn, and a new star tile asset.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
[gd_resource type="ArrayMesh" format=4 uid="uid://cv4bedhida00g"]
|
[gd_resource type="ArrayMesh" format=4 uid="uid://cv4bedhida00g"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://dqpr1nug528ml" path="res://assets/textures/tile_star_holo.png" id="1_max3p"]
|
[ext_resource type="Texture2D" uid="uid://ho2ba1pl835k" path="res://assets/textures/tile_star.png" id="1_max3p"]
|
||||||
|
|
||||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ra1lt"]
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ra1lt"]
|
||||||
resource_name = "boost"
|
resource_name = "boost"
|
||||||
|
|||||||
+9
-7
@@ -1075,13 +1075,15 @@ func sync_full_grid_data(data: PackedInt32Array):
|
|||||||
|
|
||||||
func _on_timer_updated(time_remaining: float):
|
func _on_timer_updated(time_remaining: float):
|
||||||
# Update standalone timer display
|
# Update standalone timer display
|
||||||
var time_text = str(int(time_remaining))
|
# DISABLED: Now used for PowerUp Cooldown (handled in UIManager)
|
||||||
|
# var time_text = str(int(time_remaining))
|
||||||
var timer_panel = get_node_or_null("GoalsTimer")
|
#
|
||||||
if timer_panel:
|
# var timer_panel = get_node_or_null("GoalsTimer")
|
||||||
var timer_label = timer_panel.get_node_or_null("VBox/TimerLabel")
|
# if timer_panel:
|
||||||
if timer_label:
|
# var timer_label = timer_panel.get_node_or_null("VBox/TimerLabel")
|
||||||
timer_label.text = time_text
|
# if timer_label:
|
||||||
|
# timer_label.text = time_text
|
||||||
|
pass
|
||||||
|
|
||||||
func _on_score_updated(peer_id: int, new_score: int):
|
func _on_score_updated(peer_id: int, new_score: int):
|
||||||
# Update player's score display
|
# Update player's score display
|
||||||
|
|||||||
+7
-17
@@ -9496,25 +9496,15 @@ text = "0"
|
|||||||
horizontal_alignment = 2
|
horizontal_alignment = 2
|
||||||
|
|
||||||
[node name="GoalsTimer" type="PanelContainer" parent="." unique_id=2106663301]
|
[node name="GoalsTimer" type="PanelContainer" parent="." unique_id=2106663301]
|
||||||
offset_left = 145.0
|
offset_left = 160.0
|
||||||
offset_top = 28.0
|
offset_top = 130.0
|
||||||
offset_right = 222.0
|
offset_right = 192.0
|
||||||
offset_bottom = 105.0
|
offset_bottom = 158.0
|
||||||
|
|
||||||
[node name="VBox" type="VBoxContainer" parent="GoalsTimer" unique_id=231693109]
|
[node name="TimerLabel" type="Label" parent="GoalsTimer" unique_id=466345203]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
alignment = 1
|
theme_override_font_sizes/font_size = 14
|
||||||
|
text = "00"
|
||||||
[node name="TimerLabel" type="Label" parent="GoalsTimer/VBox" unique_id=466345203]
|
|
||||||
layout_mode = 2
|
|
||||||
theme_override_font_sizes/font_size = 32
|
|
||||||
text = "60"
|
|
||||||
horizontal_alignment = 1
|
|
||||||
|
|
||||||
[node name="SuffixLabel" type="Label" parent="GoalsTimer/VBox" unique_id=1276360987]
|
|
||||||
layout_mode = 2
|
|
||||||
theme_override_font_sizes/font_size = 12
|
|
||||||
text = "seconds"
|
|
||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
|
|
||||||
[node name="GlobalMatchTimer" type="PanelContainer" parent="." unique_id=1714357974]
|
[node name="GlobalMatchTimer" type="PanelContainer" parent="." unique_id=1714357974]
|
||||||
|
|||||||
@@ -121,6 +121,22 @@ func get_max_points() -> int:
|
|||||||
func get_fill_percentage() -> float:
|
func get_fill_percentage() -> float:
|
||||||
return current_boost / MAX_BOOST
|
return current_boost / MAX_BOOST
|
||||||
|
|
||||||
|
func get_time_until_full() -> float:
|
||||||
|
if current_boost >= MAX_BOOST:
|
||||||
|
return 0.0
|
||||||
|
|
||||||
|
# Calculate remaining points needed
|
||||||
|
var remaining = MAX_BOOST - current_boost
|
||||||
|
|
||||||
|
# Get current fill rate
|
||||||
|
var level_idx = clamp(current_level - 1, 0, FILL_TIMES.size() - 1)
|
||||||
|
var fill_time = FILL_TIMES[level_idx]
|
||||||
|
var current_rate = MAX_BOOST / fill_time
|
||||||
|
|
||||||
|
if current_rate <= 0: return 0.0
|
||||||
|
|
||||||
|
return remaining / current_rate
|
||||||
|
|
||||||
func get_bars() -> int:
|
func get_bars() -> int:
|
||||||
"""Returns the number of filled segments (0-4)."""
|
"""Returns the number of filled segments (0-4)."""
|
||||||
# Each bar is 25 points (100 / 4)
|
# Each bar is 25 points (100 / 4)
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ var victory_ui_instance
|
|||||||
var playerboard_ui
|
var playerboard_ui
|
||||||
var action_menu_instance
|
var action_menu_instance
|
||||||
var powerup_inventory_ui
|
var powerup_inventory_ui
|
||||||
|
var timer_label: Label
|
||||||
|
|
||||||
var local_player_character
|
var local_player_character
|
||||||
var _previous_playerboard_state: Array = []
|
var _previous_playerboard_state: Array = []
|
||||||
@@ -235,6 +236,8 @@ func _connect_powerup_manager_deferred(player):
|
|||||||
powerup_manager.points_changed.connect(_on_powerup_points_changed)
|
powerup_manager.points_changed.connect(_on_powerup_points_changed)
|
||||||
# Initialize bar with current values
|
# Initialize bar with current values
|
||||||
update_powerup_bar(powerup_manager.get_points(), powerup_manager.get_max_points())
|
update_powerup_bar(powerup_manager.get_points(), powerup_manager.get_max_points())
|
||||||
|
# Force initial label update
|
||||||
|
_on_powerup_points_changed(powerup_manager.get_points(), powerup_manager.get_max_points())
|
||||||
else:
|
else:
|
||||||
push_warning("[UIManager] PowerUpManager not found on player after 0.8s wait")
|
push_warning("[UIManager] PowerUpManager not found on player after 0.8s wait")
|
||||||
|
|
||||||
@@ -294,6 +297,7 @@ func update_powerup_bar(current_points: int, _max_points: int):
|
|||||||
var _previous_bars: int = 0
|
var _previous_bars: int = 0
|
||||||
|
|
||||||
func _on_powerup_points_changed(current: int, max_points: int):
|
func _on_powerup_points_changed(current: int, max_points: int):
|
||||||
|
if current % 10 == 0: print("[UIManager] Points changed: ", current)
|
||||||
# Calculate based on max points (100) / 4 segments = 25 points per segment
|
# Calculate based on max points (100) / 4 segments = 25 points per segment
|
||||||
var new_bars = int(current / 25.0)
|
var new_bars = int(current / 25.0)
|
||||||
|
|
||||||
@@ -308,6 +312,17 @@ func _on_powerup_points_changed(current: int, max_points: int):
|
|||||||
_previous_bars = new_bars
|
_previous_bars = new_bars
|
||||||
update_powerup_bar(current, max_points)
|
update_powerup_bar(current, max_points)
|
||||||
|
|
||||||
|
# Update Safety: Check if timer_label is valid
|
||||||
|
if timer_label and local_player_character and local_player_character.powerup_manager:
|
||||||
|
var time_left = local_player_character.powerup_manager.get_time_until_full()
|
||||||
|
if time_left <= 0:
|
||||||
|
timer_label.text = " READY "
|
||||||
|
timer_label.add_theme_color_override("font_color", Color(0.3, 0.9, 0.3)) # Green
|
||||||
|
else:
|
||||||
|
# User request: "Do it on int not float"
|
||||||
|
timer_label.text = str(int(ceil(time_left))) + "s"
|
||||||
|
timer_label.add_theme_color_override("font_color", Color(1.0, 0.85, 0.2)) # Gold
|
||||||
|
|
||||||
func _pulse_segment(segment: Panel):
|
func _pulse_segment(segment: Panel):
|
||||||
"""Create a visual pulse effect on a powerup segment."""
|
"""Create a visual pulse effect on a powerup segment."""
|
||||||
var original_scale = segment.scale
|
var original_scale = segment.scale
|
||||||
@@ -371,13 +386,13 @@ func setup_timer_labels(main_node):
|
|||||||
goals_timer.add_theme_stylebox_override("panel", style)
|
goals_timer.add_theme_stylebox_override("panel", style)
|
||||||
|
|
||||||
# Style the timer label
|
# Style the timer label
|
||||||
var timer_label = goals_timer.get_node_or_null("VBox/TimerLabel")
|
var t_label = goals_timer.get_node_or_null("TimerLabel")
|
||||||
if timer_label:
|
if t_label:
|
||||||
timer_label.add_theme_color_override("font_color", Color(1.0, 0.85, 0.2))
|
timer_label = t_label # Store reference
|
||||||
|
t_label.add_theme_color_override("font_color", Color(1.0, 0.85, 0.2))
|
||||||
var suffix_label = goals_timer.get_node_or_null("VBox/SuffixLabel")
|
print("[UIManager] SUCCESS: Found and stored TimerLabel reference.")
|
||||||
if suffix_label:
|
else:
|
||||||
suffix_label.add_theme_color_override("font_color", Color(0.7, 0.7, 0.7))
|
print("[UIManager] ERROR: GoalsTimer found but TimerLabel NOT found at node/TimerLabel")
|
||||||
|
|
||||||
# Method to update leaderboard with all players in match
|
# Method to update leaderboard with all players in match
|
||||||
func initialize_leaderboard_with_players(players: Array):
|
func initialize_leaderboard_with_players(players: Array):
|
||||||
|
|||||||
Reference in New Issue
Block a user