Difference between revisions of "Sound Functions"
(added sound functions) |
(→PlayMusic("Music",v)) |
||
Line 18: | Line 18: | ||
− | == PlayMusic("Music" | + | == PlayMusic("Music") == |
[require Xmoto >= 0.4.2] | [require Xmoto >= 0.4.2] | ||
=== Explanation === | === Explanation === | ||
− | Using this function you can play a music. The parameter 1 is the name of the musicd, which is defined in the actually used theme file | + | Using this function you can play a music. The parameter 1 is the name of the musicd, which is defined in the actually used theme file. |
In the following example, there must be 3 zones named "Zone0", "Zone1" and "Zone2". As soon as you enter the zone, the music is played: | In the following example, there must be 3 zones named "Zone0", "Zone1" and "Zone2". As soon as you enter the zone, the music is played: | ||
Line 40: | Line 40: | ||
Game.PlayMusic("madeirastew",0.5); | Game.PlayMusic("madeirastew",0.5); | ||
end | end | ||
− | |||
== StopMusic(); == | == StopMusic(); == |
Revision as of 13:42, 15 March 2008
Contents
PlaySound("Sound",v)
[require Xmoto >= 0.4.2]
Explanation
Using this function you can play a sound effect. The parameter 1 is the name of the sound, which is defined in the actually used theme file. Parameter 2 (v) is optional, and sets the Volume, in which the Sound shall be played. In the following example, there must be 2 zones named "Zone0" and "Zone1". As soon as you enter the zone, the sound effect is played:
Script example
Zone0 = {} Zone1 = {} function Zone0.OnEnter() Game.PlaySound("ring"); end function Zone1.OnEnter() Game.PlaySound("ring",0.2); end
PlayMusic("Music")
[require Xmoto >= 0.4.2]
Explanation
Using this function you can play a music. The parameter 1 is the name of the musicd, which is defined in the actually used theme file. In the following example, there must be 3 zones named "Zone0", "Zone1" and "Zone2". As soon as you enter the zone, the music is played:
Script example
Zone0 = {} Zone1 = {} Zone2 = {} function Zone0.OnEnter() Game.PlayMusic("batcave"); end function Zone1.OnEnter() Game.StopMusic(); end function Zone2.OnEnter() Game.PlayMusic("madeirastew",0.5); end
StopMusic();
[require Xmoto >= 0.4.2]
Explanation
With this function you stop music playback for the current level.
Script example
Zone0 = {} Zone1 = {} function Zone0.OnEnter() Game.PlayMusic("batcave"); end function Zone1.OnEnter() Game.StopMusic(); end