feat: introduce Stop N Go game mode with phase management, dynamic arena setup, and goal tracking.

This commit is contained in:
Yogi Wiguna
2026-02-24 11:02:14 +08:00
parent ea49eb2e4a
commit 0e44737278
3 changed files with 13 additions and 7 deletions
+7 -2
View File
@@ -249,8 +249,8 @@ func broadcast_message(player_name: String, message: String):
func _setup_global_match_timer_ui():
"""Create the global match timer display at the top of the screen."""
# Check if timer check is enabled in lobby settings
if not LobbyManager.enable_cycle_timer:
# Check if timer check is enabled in lobby settings OR if in Stop n Go mode
if not LobbyManager.enable_cycle_timer and LobbyManager.game_mode != "Stop n Go":
var existing = get_node_or_null("GlobalMatchTimer")
if existing:
existing.visible = false
@@ -563,6 +563,11 @@ func _start_game():
# Only Server starts the mode logic (arena setup, missions, etc)
if stop_n_go_manager:
stop_n_go_manager.start_game_mode()
# Also start global match timer for Stop n Go
if goals_cycle_manager:
var match_duration = LobbyManager.get_match_duration()
goals_cycle_manager.start_match(float(match_duration), false) # No cycles for Stop n Go
elif goals_cycle_manager:
var match_duration = LobbyManager.get_match_duration()
goals_cycle_manager.start_match(float(match_duration))
+4 -3
View File
@@ -93,7 +93,7 @@ func _process(delta):
# Global Match Control
# =============================================================================
func start_match(duration_seconds: float):
func start_match(duration_seconds: float, start_cycles: bool = true):
"""Start the global match timer. Called by server when game starts."""
match_duration = duration_seconds
global_match_timer = duration_seconds
@@ -103,8 +103,9 @@ func start_match(duration_seconds: float):
if multiplayer.is_server():
rpc("sync_match_start", duration_seconds)
# Also start the first cycle
start_cycle()
# Only start the first cycle if requested
if start_cycles:
start_cycle()
func _on_match_end():
"""Called when global match timer reaches zero - game over!"""
+2 -2
View File
@@ -9,8 +9,8 @@ signal player_penalized(player_id: int)
enum Phase {GO, STOP}
const GO_DURATION: float = 12.0
const STOP_DURATION: float = 6.0
const GO_DURATION: float = 8.0
const STOP_DURATION: float = 4.0
const REQUIRED_GOALS: int = 2
var current_phase: Phase = Phase.GO