Skip to content

Commit

Permalink
add debounce audio
Browse files Browse the repository at this point in the history
  • Loading branch information
myin142 committed Sep 23, 2023
1 parent af19746 commit db85782
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions godot/shared/DebounceAudio.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
extends AudioStreamPlayer

var timer: Timer

func _ready():
timer = Timer.new()
timer.one_shot = true
add_child(timer)
timer.timeout.connect(func(): super.play())

func play_debounce(time := 0.1):
timer.start(time)

0 comments on commit db85782

Please sign in to comment.