This commit is contained in:
2026-02-02 08:34:04 +08:00
parent d6c84dd30d
commit 9201c99d42
3 changed files with 113 additions and 17 deletions
+8 -1
View File
@@ -9,6 +9,7 @@ var use_diagonal_movement: bool = false
var is_moving: bool = false
var rotation_speed: float = 10.0
var target_rotation: float = 0.0
var speed_multiplier: float = 1.0 # For slow-mo effects
func initialize(p_player: Node3D, p_gridmap: Node):
player = p_player
@@ -123,7 +124,6 @@ func try_push(target_pos: Vector2i, direction: Vector2i) -> bool:
if enhanced_gridmap.is_position_valid(pushed_to_pos) and \
enhanced_gridmap.get_cell_item(Vector3i(pushed_to_pos.x, 0, pushed_to_pos.y)) != -1 and \
not player.is_position_occupied(pushed_to_pos):
# Valid push
var push_path = [Vector2(pushed_to_pos.x, pushed_to_pos.y)]
other_player.rpc("start_movement_along_path", push_path, false)
@@ -142,6 +142,13 @@ func try_push(target_pos: Vector2i, direction: Vector2i) -> bool:
return true
func set_speed_multiplier(multiplier: float):
speed_multiplier = multiplier
# If we are currently moving, we might need to adjust the speed of the active tween?
# However, the movement is handled via RPC 'start_movement_along_path' which
# likely uses a fixed speed or duration on all clients.
# Let's check how 'start_movement_along_path' is implemented in player.gd.
func buffer_move_input(direction: Vector2i):
buffered_direction = direction