Differences

This shows you the differences between the selected revision and the current
version of the page.


wmebook:ch10 2007/12/10 20:26 wmebook:ch10 2008/01/10 14:12 current
Line 35: Line 35:
  * **Game.SetMusicVolume(volume);** sets new volume //(SetMusicChannelVolume(channel,volume)//   * **Game.SetMusicVolume(volume);** sets new volume //(SetMusicChannelVolume(channel,volume)//
-There are more methods but for now we'll be happy with those. Now what's the difference from using channel version? You can use more music tracks at the same time, you can crossfade them (one goes volume down while the other volume up for seamless transition).+There are more methods but for now we'll be happy with those. Now what's the difference from using channel versions? You can use more music tracks at the same time, you can crossfade them (one goes volume down while the other volume up for seamless transition).
Open the **scene_init.script** of the Dream scene and modify the beginning. Open the **scene_init.script** of the Dream scene and modify the beginning.
Line 58: Line 58:
We've first of all used the music channel 0 for the music playing, but we've also set the track to //looping// track by providing **true** as a looping value. We've first of all used the music channel 0 for the music playing, but we've also set the track to //looping// track by providing **true** as a looping value.
-For crossfading we use **Game.MusicCrossfade(channel1,channel2,time, swap);** which is a method decreasing volume of channel1 and increasing volume of channel2 in time. Swap means that what was in the channel1 gets to channel2 and vice versa so you after the crossfade operate with channel1 for the new track. Note that this is automatically **true**, so if you don't want the swap you have to specify **false** as the last parameter. +For crossfading we use **Game.MusicCrossfade(channel1,channel2,time, swap);** which is a method decreasing volume of channel1 and increasing volume of channel2 in time. Swap means that what was in the channel1 gets to channel2 and vice versa so new track is - after the crossfade - in channel1. Note that this is automatically **true**, so if you don't want the swap you have to specify **false** as the last parameter.
In this light, we'll open the Street scene and modify **scene_init.script** at the bottom to read: In this light, we'll open the Street scene and modify **scene_init.script** at the bottom to read:
Line 143: Line 143:
</code> </code>
-Now we could easily expect that we could play sound through PlaySound (similary to PlayMusic) and stop it through StopSound (Similary to StopMusic), but here we're doing more magic.  +As we could easily expect, we can play sound through **PlaySound** (similary to PlayMusic) and stop it through **StopSound** (Similary to StopMusic), we can **PauseSound** or **ResumeSound** - we've seen it before and the logic is the same as in the music but here we're doing more magic.  
-We first get a Node (our newly created sprite entity Fun) and attach sound to it. Then we move the entity on the screen and sound follows the position on the screen so it runs from left to right.+First we get a Node (our newly created sprite entity Fun) and attach sound to it. Then we move the entity on the screen and sound follows the position on the screen so it runs from left to right.
If we assigned any imagery to the sound, we could easily have a passing car followed by its sound. Neat, isn't it? If we assigned any imagery to the sound, we could easily have a passing car followed by its sound. Neat, isn't it?
Line 153: Line 153:
Just for the record as a very advanced feature we can set a realtime ambience for the sound, we have triplet of the functions: Just for the record as a very advanced feature we can set a realtime ambience for the sound, we have triplet of the functions:
-**SoundFXEcho**, **SoundFXReverb** and **SoundFXNone**, but usage is beyond the scope of this book. For inquisitive mindcs it can be great to have one sound and then adding realtime ambience through WME rather than having multitude of sounds.+**SoundFXEcho**, **SoundFXReverb** and **SoundFXNone**, but usage is beyond the scope of this book. For inquisitive minds, it can be great to have one sound and then adding realtime ambience through WME rather than having multitude of sounds.
But back to our modest needs. As a demonstration we'll handle a door. There are three states - locked door, unlocking the door and open door squeak. But back to our modest needs. As a demonstration we'll handle a door. There are three states - locked door, unlocking the door and open door squeak.
 
wmebook/ch10.1197314788.txt.gz · Last modified: 2007/12/10 20:26 by metamorphium
Recent changes RSS feed Creative Commons License Driven by DokuWiki