Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

TIC-80

Fantasy computer for making, playing and sharing tiny games. · By Nesbox

Repeating sfx while mouse button down

A topic by Paul59 created Dec 14, 2019 Views: 158
Viewing posts 1 to 1

I'd like a sound to play (in full) repeatedly while the mouse button is held down (it's a laser being fired). When the button is down, provided the laser has sufficient charge, I'm playing the sound. However, on the next tick the button might still be down and so the sound is played again from the beginning rather than a new sound being queued. As there doesn't seem to be a way to detect if a channel is playing, how do I handle this? The only thing I can think of is starting a timer and checking if it's finished before starting the new sfx but it seems a lot of work!