forked from team-sg/hero-mark-2
scholar of the first climbing sound
This commit is contained in:
parent
469efad30d
commit
7b0fb8ece5
3 changed files with 17 additions and 2 deletions
|
@ -11,5 +11,5 @@ dest_files=[ "res://.import/a_bmilc.ogg-cb786a4aec8fbf031b4e9635d452a4a8.oggstr"
|
|||
|
||||
[params]
|
||||
|
||||
loop=true
|
||||
loop=false
|
||||
loop_offset=0
|
||||
|
|
|
@ -11,5 +11,5 @@ dest_files=[ "res://.import/a_climb.ogg-478222e5725714de088f1c4b609997c5.oggstr"
|
|||
|
||||
[params]
|
||||
|
||||
loop=true
|
||||
loop=false
|
||||
loop_offset=0
|
||||
|
|
|
@ -166,6 +166,7 @@ func _on_Climbing_state_entered() -> void:
|
|||
func _on_Climbing_state_exited() -> void:
|
||||
_attached_ladder = null
|
||||
animation_player.playback_speed = 1.0 # restore playback speed
|
||||
Audio.ac_climb.stream = null # stop audio
|
||||
|
||||
# all the stuff that happens when they DIE
|
||||
func _on_Dead_state_entered() -> void:
|
||||
|
@ -214,6 +215,20 @@ func _process_climbing(delta: float) -> void:
|
|||
velocity.y = input_dir * climb_speed # move in input direction
|
||||
animation_player.playback_speed = abs(input_dir) # play/pause animation
|
||||
|
||||
# play sound
|
||||
if input_dir < 0.0:
|
||||
if Audio.ac_climb.stream != Audio.a_climb_up:
|
||||
Audio.play_sound(Audio.a_climb_up, Audio.ac_climb)
|
||||
if Audio.ac_climb.get_playback_position() >= Audio.a_climb_up.get_length():
|
||||
Audio.ac_climb.play()
|
||||
elif input_dir > 0.0:
|
||||
if Audio.ac_climb.stream != Audio.a_climb_down:
|
||||
Audio.play_sound(Audio.a_climb_down, Audio.ac_climb)
|
||||
if Audio.ac_climb.get_playback_position() >= Audio.a_climb_down.get_length():
|
||||
Audio.ac_climb.play()
|
||||
else:
|
||||
Audio.ac_climb.stream = null
|
||||
|
||||
# # switching sides of ladder
|
||||
# if global_position.x < _attached_ladder.middle and Input.is_action_just_pressed("ui_right"):
|
||||
# global_position.x = _attached_ladder.right_snap
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue