Difference between revisions of "Legacy:Sound/stop"
From Spherical
(Creates sound.stop page) |
(No difference)
|
Revision as of 22:03, 20 May 2013
Play a loaded sound.
Usage
sound.stop();
- sound Sphere Sound object. The sound to stop.
Examples
Stopping and playing sound with the enter key:
var my_music = LoadSound("your_sound.ogg");
var toggle = false;
my_music.play(true);
while (!IsKeyPressed(KEY_ESCAPE))
{
while (AreKeysLeft()) {
if (GetKey() == KEY_ENTER) toggle ? my_music.play() : my_music.stop();
}
}
Notice the above is different from pause which will continue where you left off.
See also
- Sphere Sound object
- Sound.play(repeat)
- Sound.isPlaying()
- Sound.pause()
- IsKeyPressed()