feat: Introduce PlayerMovementManager to centralize grid-based player and bot movement, including multiplayer synchronization and push interactions.
This commit is contained in:
@@ -2261,6 +2261,26 @@ func update_active_player_indicator():
|
||||
else:
|
||||
sync_modulate(color) # Apply locally if offline/not ready
|
||||
|
||||
@rpc("any_peer", "call_local", "unreliable")
|
||||
func sync_bump(target_pos: Vector2i, is_soft: bool = false):
|
||||
"""Visual attack 'bump' or collision animation."""
|
||||
# Always return to LOGICAL position to prevent character drift!
|
||||
var original_pos = grid_to_world(current_position)
|
||||
var target_world = grid_to_world(target_pos)
|
||||
|
||||
# If it's a soft bump (non-attack), just a tiny nudge
|
||||
var strength = 0.4 if not is_soft else 0.15
|
||||
var duration = 0.1 if not is_soft else 0.08
|
||||
|
||||
var mid_pos = original_pos.lerp(target_world, strength)
|
||||
|
||||
var tween = create_tween()
|
||||
# Ensure the character starts at logical pos if they were drifting
|
||||
global_position = original_pos
|
||||
|
||||
tween.tween_property(self, "global_position", mid_pos, duration).set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_OUT)
|
||||
tween.tween_property(self, "global_position", original_pos, duration).set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_IN)
|
||||
|
||||
func knock_tekton():
|
||||
if not is_multiplayer_authority() or is_frozen or is_stop_frozen:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user