Legacy:Sound/stop: Difference between revisions
Jump to navigation
Jump to search
Creates sound.stop page |
navboxed |
||
| Line 32: | Line 32: | ||
* [[API:IsKeyPressed|IsKeyPressed]]() | * [[API:IsKeyPressed|IsKeyPressed]]() | ||
{{API:Sound/navbox}} | |||
Latest revision as of 22:39, 30 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()