feat: Implement new Stop 'n' Go game mode with dedicated manager, player logic, and control scripts.
This commit is contained in:
@@ -160,7 +160,7 @@ func _create_touch_ui():
|
||||
# User Request: "move those button to ActionsBtn children"
|
||||
|
||||
attack_mode_button = _find_or_create_action_button(actions_container, "AttackMode", "⚡", button_positions.attack_mode) # Renamed
|
||||
spawn_boost_button = _find_or_create_action_button(actions_container, "SpawnBoost", "🚀", button_positions.spawn_boost)
|
||||
# spawn_boost_button = _find_or_create_action_button(actions_container, "SpawnBoost", "🚀", button_positions.spawn_boost)
|
||||
grab_button = _find_or_create_action_button(actions_container, "Grab", "👋", button_positions.grab)
|
||||
put_button = _find_or_create_action_button(actions_container, "Put", "📦", button_positions.put)
|
||||
|
||||
@@ -173,10 +173,10 @@ func _create_touch_ui():
|
||||
attack_mode_button.icon = load("res://assets/graphics/touch_control/attack_mode.png")
|
||||
attack_mode_button.expand_icon = true
|
||||
|
||||
if spawn_boost_button:
|
||||
actions_container.move_child(spawn_boost_button, 1)
|
||||
spawn_boost_button.icon = load("res://assets/graphics/touch_control/spawn_tile.png")
|
||||
spawn_boost_button.expand_icon = true
|
||||
# if spawn_boost_button:
|
||||
# actions_container.move_child(spawn_boost_button, 1)
|
||||
# spawn_boost_button.icon = load("res://assets/graphics/touch_control/spawn_tile.png")
|
||||
# spawn_boost_button.expand_icon = true
|
||||
|
||||
if grab_button:
|
||||
actions_container.move_child(grab_button, 2)
|
||||
@@ -308,7 +308,7 @@ func _ensure_shortcut_label(btn: Button, button_name: String):
|
||||
"Grab": existing_lbl.text = SettingsManager.get_control_text("grab")
|
||||
"Put": existing_lbl.text = ""
|
||||
"AttackMode": existing_lbl.text = SettingsManager.get_control_text("attack_mode")
|
||||
"SpawnBoost": existing_lbl.text = SettingsManager.get_control_text("spawn_boost")
|
||||
# "SpawnBoost": existing_lbl.text = SettingsManager.get_control_text("spawn_boost")
|
||||
"TektonGrab": existing_lbl.text = SettingsManager.get_control_text("tekton_grab")
|
||||
|
||||
|
||||
@@ -341,7 +341,7 @@ func _ensure_shortcut_label(btn: Button, button_name: String):
|
||||
"Grab": shortcut_lbl.text = SettingsManager.get_control_text("grab") if SettingsManager else "Space"
|
||||
"Put": shortcut_lbl.text = "" # Disabled shortcut
|
||||
"AttackMode": shortcut_lbl.text = SettingsManager.get_control_text("attack_mode") if SettingsManager else "Q"
|
||||
"SpawnBoost": shortcut_lbl.text = SettingsManager.get_control_text("spawn_boost") if SettingsManager else "E"
|
||||
# "SpawnBoost": shortcut_lbl.text = SettingsManager.get_control_text("spawn_boost") if SettingsManager else "E"
|
||||
"TektonGrab": shortcut_lbl.text = SettingsManager.get_control_text("tekton_grab") if SettingsManager else "G"
|
||||
|
||||
|
||||
@@ -394,13 +394,16 @@ func _on_button_pressed(button_name: String):
|
||||
pass
|
||||
else:
|
||||
print("[TouchControls] PowerUpManager missing on player")
|
||||
"SpawnBoost":
|
||||
if local_player and local_player.is_carrying_tekton:
|
||||
# "SpawnBoost":
|
||||
# if local_player and local_player.is_carrying_tekton:
|
||||
# if local_player.powerup_manager and local_player.powerup_manager.has_method("spawn_boost_reward"):
|
||||
# local_player.powerup_manager.spawn_boost_reward()
|
||||
"TektonGrab":
|
||||
if local_player.is_carrying_tekton:
|
||||
if local_player.powerup_manager and local_player.powerup_manager.has_method("spawn_boost_reward"):
|
||||
local_player.powerup_manager.spawn_boost_reward()
|
||||
"TektonGrab":
|
||||
if not local_player.is_carrying_tekton:
|
||||
if local_player.has_method("grab_tekton"):
|
||||
else:
|
||||
if not local_player.is_carrying_tekton and local_player.has_method("grab_tekton"):
|
||||
local_player.grab_tekton()
|
||||
|
||||
|
||||
@@ -523,13 +526,14 @@ func _apply_settings():
|
||||
attack_mode_button.offset_bottom = button_positions.attack_mode.y + button_size
|
||||
|
||||
if spawn_boost_button:
|
||||
spawn_boost_button.visible = true
|
||||
spawn_boost_button.scale = Vector2(button_scale, button_scale)
|
||||
spawn_boost_button.set_anchors_preset(Control.PRESET_BOTTOM_RIGHT)
|
||||
spawn_boost_button.offset_left = button_positions.spawn_boost.x
|
||||
spawn_boost_button.offset_top = button_positions.spawn_boost.y
|
||||
spawn_boost_button.offset_right = button_positions.spawn_boost.x + button_size
|
||||
spawn_boost_button.offset_bottom = button_positions.spawn_boost.y + button_size
|
||||
# spawn_boost_button.visible = true
|
||||
# spawn_boost_button.scale = Vector2(button_scale, button_scale)
|
||||
# spawn_boost_button.set_anchors_preset(Control.PRESET_BOTTOM_RIGHT)
|
||||
# spawn_boost_button.offset_left = button_positions.spawn_boost.x
|
||||
# spawn_boost_button.offset_top = button_positions.spawn_boost.y
|
||||
# spawn_boost_button.offset_right = button_positions.spawn_boost.x + button_size
|
||||
# spawn_boost_button.offset_bottom = button_positions.spawn_boost.y + button_size
|
||||
spawn_boost_button.visible = false
|
||||
|
||||
if tekton_grab_button:
|
||||
tekton_grab_button.visible = true
|
||||
@@ -598,15 +602,28 @@ func _on_boost_points_changed(current_points: int, max_points: int):
|
||||
_update_boost_button_state(attack_mode_button, can_attack)
|
||||
|
||||
# SpawnBoost depends on carrying a Tekton, not boost points
|
||||
var can_spawn = local_player and local_player.is_carrying_tekton
|
||||
_update_boost_button_state(spawn_boost_button, can_spawn)
|
||||
# var can_spawn = local_player and local_player.is_carrying_tekton
|
||||
# _update_boost_button_state(spawn_boost_button, can_spawn)
|
||||
|
||||
# Tekton Grab (👋) is only enabled if full AND not already carrying one
|
||||
var can_grab = is_full and not (local_player and local_player.is_carrying_tekton)
|
||||
_update_boost_button_state(tekton_grab_button, can_grab)
|
||||
# Now modified: If CARRYING, it is ALWAYS enabled to act as SpawnBoost. If NOT carrying, needs to be full.
|
||||
var can_grab_or_spawn = (local_player and local_player.is_carrying_tekton) or (is_full)
|
||||
_update_boost_button_state(tekton_grab_button, can_grab_or_spawn)
|
||||
|
||||
func _on_tekton_carried_changed(_is_carrying: bool):
|
||||
# Refresh button states when player grabs/throws a tekton
|
||||
if tekton_grab_button:
|
||||
if _is_carrying:
|
||||
# Swapping to Spawn function (Hotkey E)
|
||||
tekton_grab_button.icon = load("res://assets/graphics/touch_control/spawn_tile.png")
|
||||
if SettingsManager:
|
||||
_ensure_shortcut_label(tekton_grab_button, "SpawnBoost")
|
||||
else:
|
||||
# Swapping back to Grab function (Hotkey G)
|
||||
tekton_grab_button.icon = load("res://assets/graphics/touch_control/grab_tekton.png")
|
||||
if SettingsManager:
|
||||
_ensure_shortcut_label(tekton_grab_button, "TektonGrab")
|
||||
|
||||
var powerup_mgr = local_player.get_node_or_null("PowerUpManager")
|
||||
if powerup_mgr:
|
||||
_on_boost_points_changed(powerup_mgr.current_boost, powerup_mgr.MAX_BOOST)
|
||||
|
||||
Reference in New Issue
Block a user