feat: Implement core player character logic and input handling, including movement, actions, and manager integration.
This commit is contained in:
@@ -46,50 +46,7 @@ func _process(delta):
|
||||
if target_position != player.current_position:
|
||||
movement_manager.simple_move_to(target_position)
|
||||
|
||||
# === KEYBOARD SHORTCUTS (User Request) ===
|
||||
|
||||
# Numpad 1: Speed (Enum 0)
|
||||
if Input.is_key_pressed(KEY_KP_1):
|
||||
player.attempt_target_action(0) # FASTER_SPEED
|
||||
|
||||
# Numpad 2: Wall (Enum 2)
|
||||
elif Input.is_key_pressed(KEY_KP_2):
|
||||
player.attempt_target_action(2) # BLOCK_FLOOR
|
||||
|
||||
# Numpad 3: Freeze (Enum 1)
|
||||
elif Input.is_key_pressed(KEY_KP_3):
|
||||
player.attempt_target_action(1) # AREA_FREEZE
|
||||
|
||||
# Numpad 4: Ghost (Enum 3)
|
||||
elif Input.is_key_pressed(KEY_KP_4):
|
||||
player.attempt_target_action(3) # INVISIBLE_MODE
|
||||
|
||||
# C: Special Attack (Attack Mode) - Boost
|
||||
elif Input.is_key_pressed(KEY_C):
|
||||
if player.powerup_manager:
|
||||
player.powerup_manager.use_special_effect()
|
||||
|
||||
# V: Spawn Boost Item
|
||||
elif Input.is_key_pressed(KEY_V):
|
||||
if player.powerup_manager:
|
||||
# Verify the method exists first (it was added recently/confirmed available)
|
||||
if player.powerup_manager.has_method("spawn_boost_reward"):
|
||||
player.powerup_manager.spawn_boost_reward()
|
||||
else:
|
||||
# Fallback if method missing
|
||||
player.powerup_manager.use_special_effect()
|
||||
|
||||
# Original 1-4 keys (Succession order 0-3) - Keeping as fallback?
|
||||
# User didn't ask to remove them, but new Numpad bindings are specific.
|
||||
# We can leave them for now unless they conflict.
|
||||
if Input.is_key_pressed(KEY_1):
|
||||
player.attempt_target_action(0)
|
||||
elif Input.is_key_pressed(KEY_2):
|
||||
player.attempt_target_action(1)
|
||||
elif Input.is_key_pressed(KEY_3):
|
||||
player.attempt_target_action(2)
|
||||
elif Input.is_key_pressed(KEY_4):
|
||||
player.attempt_target_action(3)
|
||||
|
||||
# Targeting Mode Preview
|
||||
var main = player.get_node_or_null("/root/Main")
|
||||
@@ -130,7 +87,26 @@ func handle_unhandled_input(event):
|
||||
if not player.is_multiplayer_authority() or (TurnManager.turn_based_mode and (not player.is_my_turn or movement_manager.is_moving)):
|
||||
return
|
||||
|
||||
# --- Real-time Keyboard/Touch Input moved to _process ---
|
||||
# --- Keyboard Shortcuts (Event-based) ---
|
||||
if event is InputEventKey and event.pressed and not event.echo:
|
||||
match event.keycode:
|
||||
KEY_KP_1, KEY_1:
|
||||
player.activate_powerup(0) # FASTER_SPEED
|
||||
KEY_KP_2, KEY_2:
|
||||
player.activate_powerup(2) # BLOCK_FLOOR
|
||||
KEY_KP_3, KEY_3:
|
||||
player.activate_powerup(1) # AREA_FREEZE
|
||||
KEY_KP_4, KEY_4:
|
||||
player.activate_powerup(3) # INVISIBLE_MODE
|
||||
KEY_C:
|
||||
if player.powerup_manager:
|
||||
player.powerup_manager.use_special_effect()
|
||||
KEY_V:
|
||||
if player.powerup_manager:
|
||||
if player.powerup_manager.has_method("spawn_boost_reward"):
|
||||
player.powerup_manager.spawn_boost_reward()
|
||||
else:
|
||||
player.powerup_manager.use_special_effect()
|
||||
|
||||
# Handle spawn point selection if not yet selected
|
||||
|
||||
|
||||
Reference in New Issue
Block a user