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

@@ -6,7 +6,7 @@ Bob: Bonjour l'ami.
Bob: En vrai, si tu est venu jusqu'à moi et qu'on parle, je suppose que oui!
Bob: Est-ce que tu veux faire des choix?
- Non merci
Bob: Petit chenapan! Tu viens d'en faire un, tu m'a l'air d'un sacré loustique, allez file avant que je t'oublies
Bob: Petit chenapan! Tu viens d'en faire un, tu m'a l'air d'un sacré loustic, allez file avant que je t'oublies
- Oui!
Bob: Je savais que tu choisirai quelque chose. Bravo pour ce choix conséquent qui aura des conséquences conséquentes.
- Je veux recommencer cette discussion hyper utile à ma vie => start

View File

@@ -44,7 +44,7 @@ func _physics_process(delta):
else:
velocity = velocityVector * speed
if state_machine.get_current_node() == "grabing":
if state_machine.get_current_node() == "grabing" or humanInteractionTarget != null :
velocity = Vector2(0,0);
# move the caracter
@@ -53,7 +53,6 @@ func _physics_process(delta):
# compute the direction the player wants to look at
if velocity:
last_facing_direction = velocity.normalized()
stop_interaction()
updateFacingDirectionInAnimationTree()

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