From a74a19eb2f10c886adb946e1c317e1f741ebe6f6 Mon Sep 17 00:00:00 2001 From: Nilou Date: Mon, 18 Aug 2025 17:21:02 +0200 Subject: [PATCH] =?UTF-8?q?#33=20lancement=20du=20son=20de=20d=C3=A9placem?= =?UTF-8?q?ent=20quand=20le=20perso=20se=20d=C3=A9place?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entities/player/scripts/player.gd | 3 +++ 1 file changed, 3 insertions(+) diff --git a/entities/player/scripts/player.gd b/entities/player/scripts/player.gd index 8e81655..6cf236f 100644 --- a/entities/player/scripts/player.gd +++ b/entities/player/scripts/player.gd @@ -37,6 +37,7 @@ func _on_inventory_updated(_inventory: Inventory): func get_input(): if controlling_player: + var old_velocity=velocity calculate_direction() if Input.is_action_just_pressed("action") and energy > 0: @@ -46,6 +47,8 @@ func get_input(): if Input.is_action_just_pressed("drop") and inventory.lenght() > 0: var item_to_drop = inventory.pop_item() planet.drop_item(item_to_drop, global_position) + if old_velocity.length()==0 and velocity.length()!=0: + $Audio/AudioStreamPlayer_movement.play() func calculate_direction(): var input_direction: Vector2 = Input.get_vector("move_left", "move_right", "move_up", "move_down")