Graphics Reference
In-Depth Information
Figure 16-18 Playing the game with multiple views
Accessing Sound with Python
In Chapter 14, you saw how to work with basic BGE sound controls, including the 3D sound option. In this
section, you'll see how to access this data with Python and gain a greater level of control over it.
Begin with a logic brick setup associated with the Blender default cube, as shown in Figure 16-19 . The ac-
tuator is attached to a Python script controller for a script called volume.py (as always, this must be created
in the text editor first). Three sensors lead into the controller. The first sensor is an Always sensor. The second
sensorisaKeyboardsensortriggered ontheUkey,whichwillraisethevolume.ThethirdsensorisaKeyboard
sensor triggered on the D key, which will decrease the volume.
 
 
Search WWH ::




Custom Search