#33 lancement du son de déplacement quand le perso se déplace
This commit is contained in:
parent
aca0498555
commit
a74a19eb2f
@ -37,6 +37,7 @@ func _on_inventory_updated(_inventory: Inventory):
|
|||||||
|
|
||||||
func get_input():
|
func get_input():
|
||||||
if controlling_player:
|
if controlling_player:
|
||||||
|
var old_velocity=velocity
|
||||||
calculate_direction()
|
calculate_direction()
|
||||||
|
|
||||||
if Input.is_action_just_pressed("action") and energy > 0:
|
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:
|
if Input.is_action_just_pressed("drop") and inventory.lenght() > 0:
|
||||||
var item_to_drop = inventory.pop_item()
|
var item_to_drop = inventory.pop_item()
|
||||||
planet.drop_item(item_to_drop, global_position)
|
planet.drop_item(item_to_drop, global_position)
|
||||||
|
if old_velocity.length()==0 and velocity.length()!=0:
|
||||||
|
$Audio/AudioStreamPlayer_movement.play()
|
||||||
|
|
||||||
func calculate_direction():
|
func calculate_direction():
|
||||||
var input_direction: Vector2 = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
var input_direction: Vector2 = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user