Topic: Sound Scripts

I will update this post with a collection of sound scripts I am working on.

The first one I made was a script that plays a sound after a number of seconds. This script scared me, because you can't really anticipate the sound.

SoundOnTimer:

--TIME--

knock = getObject("Knock")
 i = 0

function soundOnTimer(seconds,sound)
    i = i + 1
    t = i/60
    
    if t > seconds then
        playSound(sound)
         i = 0
    end
end

function onSceneUpdate()
        soundOnTimer(10,knock)
end