Difference between revisions of "Sound Functions"

From X-Moto
Jump to: navigation, search
m (Reverted edits by Opofefemucu (Talk) to last revision by Nadenislamarre)
 
Line 1: Line 1:
----
+
== PlaySound("Sound",[v]) ==
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
+
[require Xmoto >= 0.4.2]
----
 
=[http://yxiwisewava.co.cc This Page Is Currently Under Construction And Will Be Available Shortly, Please Visit Reserve Copy Page]=
 
----
 
=[http://yxiwisewava.co.cc CLICK HERE]=
 
----
 
</div>
 
== PlaySound(&quot;Sound&quot;,[v]) ==
 
[require Xmoto &gt;= 0.4.2]
 
 
=== Explanation ===
 
=== 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. v is between 0 and 1 (0=&gt;no sound, 1=&gt; maximum sound, and for example, 0.5=&gt;50% of the volume)
+
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. v is between 0 and 1 (0=>no sound, 1=> maximum sound, and for example, 0.5=>50% of the volume)
In the following example, there must be 2 zones named &quot;Zone0&quot; and &quot;Zone1&quot;. As soon as you enter the zone, the sound effect is 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 ===
 
=== Script example ===
Line 18: Line 10:
 
   
 
   
 
  function Zone0.OnEnter()
 
  function Zone0.OnEnter()
   Game.PlaySound(&quot;ring&quot;);
+
   Game.PlaySound("ring");
 
  end
 
  end
 
   
 
   
 
  function Zone1.OnEnter()
 
  function Zone1.OnEnter()
   Game.PlaySound(&quot;ring&quot;,0.2);
+
   Game.PlaySound("ring",0.2);
 
  end
 
  end
  
== PlayMusic(&quot;Music&quot;) ==
+
== PlayMusic("Music") ==
[require Xmoto &gt;= 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 &quot;Zone0&quot;, &quot;Zone1&quot; and &quot;Zone2&quot;. 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:
  
 
=== Script example ===
 
=== Script example ===
Line 37: Line 29:
 
   
 
   
 
  function Zone0.OnEnter()
 
  function Zone0.OnEnter()
   Game.PlayMusic(&quot;batcave&quot;);
+
   Game.PlayMusic("batcave");
 
  end
 
  end
 
   
 
   
Line 45: Line 37:
 
   
 
   
 
  function Zone2.OnEnter()
 
  function Zone2.OnEnter()
   Game.PlayMusic(&quot;madeirastew&quot;,0.5);
+
   Game.PlayMusic("madeirastew",0.5);
 
  end
 
  end
  
 
== StopMusic(); ==
 
== StopMusic(); ==
[require Xmoto &gt;= 0.4.2]
+
[require Xmoto >= 0.4.2]
 
=== Explanation ===
 
=== Explanation ===
 
With this function you stop music playback for the current level.
 
With this function you stop music playback for the current level.
Line 58: Line 50:
 
   
 
   
 
  function Zone0.OnEnter()
 
  function Zone0.OnEnter()
   Game.PlayMusic(&quot;batcave&quot;);
+
   Game.PlayMusic("batcave");
 
  end
 
  end
 
   
 
   

Latest revision as of 11:24, 26 November 2010

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. v is between 0 and 1 (0=>no sound, 1=> maximum sound, and for example, 0.5=>50% of the volume) 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