Graphics Reference
In-Depth Information
2. The logic consists of an Always sensor, an And controller, and a Sound actuator, with the name of the
sound from the Audio window entered in the SO field. Set the playback mode to Loop Ping Pong in the
drop-down menu, as shown in Figure 15-57 . This will play the sound repeatedly, but every other indi-
vidual playback will be reversed, creating a seamless, continuous sound. Press P to enter the game play
mode, and you should hear the sound of bubbles rising.
Figure 15-57 Logic for the sound loop
3. To demonstrate the effect of 3D sound, add some simple motion logic to control the movement of the
cube. Set up Keyboard sensors for the up, right, left, and down arrows, and connect them with Motion
actuators moving the cube positively and negatively along the x- and y-axes, as shown in Figure 15-58 .
This will enable you to “drive” the cube around in a rudimentary way. If you haven't done so already,
select 3D sound on the Sound actuator logic brick panel.
Figure 15-58 Motion logic for the cube
You're all finished setting up the 3D sound. When you run the BGE now, you will find that the sound's
volumeisdependentontheproximityoftheCubeobjecttothecamera.BesurethatyouareintheCameraview
(press 0 on the number pad) when you enter the game play mode.
 
 
 
 
Search WWH ::




Custom Search