#33 lancement du son de déplacement quand le perso se déplace

This commit is contained in:
Nilou 2025-08-18 17:21:02 +02:00
parent aca0498555
commit a74a19eb2f

View File

@ -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")