Intérargir en marchant ne fait plus bugger

pas le temps d'expliquer, banzaï!
This commit is contained in:
Thomas
2025-03-06 09:26:45 +01:00
parent 9a0b483d96
commit 4da5046a5e
3 changed files with 6 additions and 7 deletions

View File

@@ -5,6 +5,10 @@ extends Node
var interactable : Node2D
func _unhandled_input(event: InputEvent) -> void:
human.stop_interaction()
human.velocityVector = Vector2(0, 0)
human.wants_to_grab = false
human.wants_to_interact_with = null
if (
event.is_action("move_left") or
event.is_action("move_right") or
@@ -14,13 +18,9 @@ func _unhandled_input(event: InputEvent) -> void:
human.velocityVector = Input.get_vector("move_left", "move_right", "move_up", "move_down")
if event.is_action_pressed("grab"):
if interactable:
human.stop_interaction()
human.wants_to_interact_with = interactable
else:
human.wants_to_grab = true
else:
human.wants_to_grab = false
human.wants_to_interact_with = null
func _process(delta) -> void:
ray.target_position = human.last_facing_direction * 48