Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sound = {}
- local soundChannel = {channel = audio.reserveChannels(audio.reservedChannels + 1)}
- local soundLocation = "audio/"
- local soundType = ".wav"
- local volume = 1
- function sound:Play(audioArg)
- local file = audio.loadSound(soundLocation .. audioArg .. soundType)
- local play = audio.play(file, soundChannel)
- audio.setVolume(volume, soundChannel)
- end
- function sound:Options(event)
- if event.Sound then
- if event.Sound.Volume then
- volume = event.Sound.Volume
- audio.setVolume(volume, soundChannel)
- end
- end
- end
- Runtime:addEventListener("Options", sound)
- return sound
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement