feat: Implement player input and movement managers for grid-based interaction and movement.

This commit is contained in:
Yogi Wiguna
2026-02-12 12:11:38 +08:00
parent 5cf77c19ab
commit 5275c4acd8
4 changed files with 71 additions and 7 deletions
+12 -1
View File
@@ -102,7 +102,15 @@ func handle_unhandled_input(event):
KEY_Q:
if player.powerup_manager:
# Attack Mode (formerly Special)
# Now we want "Straight to Attack Mode" style
player.powerup_manager.use_special_effect()
# Force visual update / mutual exclusivity manually if powerup manager doesn't do it yet
if player.is_attack_mode and player.has_method("enter_attack_mode"):
# Re-triggering enter_attack_mode might be redundant but safely ensures visuals/Knock=False
player.enter_attack_mode()
KEY_E:
if player.powerup_manager:
# Spawn Boost
@@ -117,7 +125,10 @@ func handle_unhandled_input(event):
else:
player.grab_tekton()
KEY_B:
player.knock_tekton()
if player.has_method("enter_knock_mode"):
player.enter_knock_mode()
else:
player.knock_tekton()
# Handle spawn point selection if not yet selected
@@ -81,6 +81,18 @@ func simple_move_to(grid_position: Vector2i) -> bool:
var push_dir = grid_position - player.current_position
if not try_push(grid_position, push_dir):
return false
# Check for Tekton interaction (Knock Mode)
# If moving into a Tekton's space while in Knock Mode, trigger knock
if player.get("is_knock_mode"):
# Find Tekton at grid_position
var tektons = player.get_tree().get_nodes_in_group("Tektons")
for t in tektons:
if t.current_position == grid_position and not t.is_carried:
# Trigger Knock
player.knock_tekton()
return false # Don't move into the tile, just knock
rotate_towards_target(grid_position)
+6 -4
View File
@@ -148,9 +148,11 @@ func _flash_damage():
var is_recovering: bool = false # True when shrunk/waiting
@rpc("any_peer", "call_local", "reliable")
func on_thrown_landing(attacker: Node = null):
"""Called when Tekton lands after being thrown."""
print("[Tekton] Landed! Shrinking and waiting...")
func on_thrown_landing(attacker: Node = null, intensity: float = 1.0):
"""Called when Tekton lands after being thrown or knocked."""
print("[Tekton] Landed/Knocked! Shrinking and waiting... (Intensity: %.1f)" % intensity)
_flash_damage() # Add visual flash too? Why not.
is_recovering = true
@@ -194,7 +196,7 @@ func on_thrown_landing(attacker: Node = null):
# Spawn tiles (as requested "tekton will spawn a tiles around that floor also")
if is_multiplayer_authority():
spawn_tiles_around(8) # Standard amount
spawn_tiles_around(int(8 * intensity))
# Floor Freeze (Visual/Instant - Run on all clients locally)
temporarily_change_floor(current_position, 1, 6, 3.0)