July 2018
Beginner to intermediate
374 pages
8h 54m
English
The Sounds.js JavaScript code collection contains the bare minimum of sounds for use in games.[17]
To use the Sounds.js code collection, it must be sourced in a <script> tag:
| | <script src="http://code3Dgames.com/sounds.js"></script> |
At the time of this writing, eleven sounds were available: bubble, buzz, click, donk, drip, guitar, knock, scratch, snick, spring, and swish. Each sound can be played with code similar to the following:
| | Sounds.bubble.play(); |
To make a sound repeat, replace the play method with repeat:
| | Sounds.bubble.repeat(); |
To stop the sound at a later time, call the stop method:
| | Sounds.bubble.stop(); |
If you want a sound to repeat for a fixed length of time, then start a repeating sound with a timeout to stop the ...
Read now
Unlock full access