feat: Implement core game systems including settings management, player input, and initial gameplay mechanics with associated UI.
This commit is contained in:
@@ -15,6 +15,7 @@ var attack_mode_button: Button # Renamed from special_button
|
||||
var spawn_boost_button: Button
|
||||
var settings_button: Button
|
||||
var tekton_grab_button: Button
|
||||
|
||||
@onready var SettingsManager = get_node_or_null("/root/SettingsManager")
|
||||
|
||||
# Settings - persisted to config file
|
||||
@@ -30,6 +31,7 @@ var button_positions: Dictionary = {
|
||||
"attack_mode": Vector2(-200, -80), # Renamed
|
||||
"spawn_boost": Vector2(-120, -80)
|
||||
}
|
||||
|
||||
var button_scale: float = 1.0
|
||||
|
||||
# Reference to main scene and player
|
||||
@@ -163,6 +165,7 @@ func _create_touch_ui():
|
||||
put_button = _find_or_create_action_button(actions_container, "Put", "📦", button_positions.put)
|
||||
|
||||
tekton_grab_button = _find_or_create_action_button(actions_container, "TektonGrab", "👋", Vector2(-280, -80))
|
||||
|
||||
|
||||
# Order: AttackMode, SpawnBoost, Grab, TektonGrab
|
||||
if attack_mode_button:
|
||||
@@ -184,6 +187,7 @@ func _create_touch_ui():
|
||||
actions_container.move_child(tekton_grab_button, 3)
|
||||
tekton_grab_button.icon = load("res://assets/graphics/touch_control/grab_tekton.png")
|
||||
tekton_grab_button.expand_icon = true
|
||||
|
||||
|
||||
# Hide Put Button
|
||||
if put_button:
|
||||
@@ -306,6 +310,7 @@ func _ensure_shortcut_label(btn: Button, button_name: String):
|
||||
"AttackMode": existing_lbl.text = SettingsManager.get_control_text("attack_mode")
|
||||
"SpawnBoost": existing_lbl.text = SettingsManager.get_control_text("spawn_boost")
|
||||
"TektonGrab": existing_lbl.text = SettingsManager.get_control_text("tekton_grab")
|
||||
|
||||
|
||||
print("[TouchControls] Updated %s shortcut label to: %s" % [button_name, existing_lbl.text])
|
||||
|
||||
@@ -338,6 +343,7 @@ func _ensure_shortcut_label(btn: Button, button_name: String):
|
||||
"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"
|
||||
"TektonGrab": shortcut_lbl.text = SettingsManager.get_control_text("tekton_grab") if SettingsManager else "G"
|
||||
|
||||
|
||||
btn.add_child(shortcut_lbl)
|
||||
|
||||
@@ -358,6 +364,7 @@ func _on_button_pressed(button_name: String):
|
||||
"AttackMode": btn = attack_mode_button
|
||||
"SpawnBoost": btn = spawn_boost_button
|
||||
"TektonGrab": btn = tekton_grab_button
|
||||
|
||||
|
||||
if btn:
|
||||
var tween = create_tween()
|
||||
@@ -396,6 +403,7 @@ func _on_button_pressed(button_name: String):
|
||||
if local_player.has_method("grab_tekton"):
|
||||
local_player.grab_tekton()
|
||||
|
||||
|
||||
func _on_button_released(button_name: String):
|
||||
var btn: Button
|
||||
match button_name:
|
||||
@@ -404,6 +412,7 @@ func _on_button_released(button_name: String):
|
||||
"AttackMode": btn = attack_mode_button
|
||||
"SpawnBoost": btn = spawn_boost_button
|
||||
"TektonGrab": btn = tekton_grab_button
|
||||
|
||||
|
||||
if btn:
|
||||
var tween = create_tween()
|
||||
@@ -445,7 +454,12 @@ func _load_settings():
|
||||
attack_mode_pos = config.get_value("touch_controls", "special_position", Vector2(-200, -80))
|
||||
|
||||
var spawn_boost_pos = config.get_value("touch_controls", "spawn_boost_position", Vector2(-120, -80))
|
||||
button_positions = {"grab": grab_pos, "put": put_pos, "attack_mode": attack_mode_pos, "spawn_boost": spawn_boost_pos}
|
||||
button_positions = {
|
||||
"grab": grab_pos,
|
||||
"put": put_pos,
|
||||
"attack_mode": attack_mode_pos,
|
||||
"spawn_boost": spawn_boost_pos
|
||||
}
|
||||
|
||||
# Apply loaded settings
|
||||
_apply_settings()
|
||||
|
||||
Reference in New Issue
Block a user