Difference between revisions of "Script Classes for Adventure Games/Sound Class"
Line 39: | Line 39: | ||
| | ||
− | + | ==<br /> The Sound Class == | |
+ | |||
+ | This is the class which allows sound to be played. | ||
+ | |||
+ | {| | ||
+ | |width= "125"|In file:||game.sc | ||
+ | |- | ||
+ | |Inherits from:||Object | ||
+ | |- | ||
+ | |Inherited by:||none | ||
+ | |} | ||
+ | |||
+ | |||
+ | ===<br /> Properties === | ||
+ | |||
+ | <blockquote> | ||
+ | ==== done ==== | ||
+ | <blockquote>Set to TRUE after the sound has finished playing, FALSE while it is playing.</blockquote> | ||
+ | |||
+ | ==== number ==== | ||
+ | <blockquote>The number of the sound.</blockquote> | ||
+ | |||
+ | ==== priority ==== | ||
+ | <blockquote>The priority of the sound if multiple sounds are playing. Most sound effects should have the default priority of 0. More important sounds (say an error beep) should have positive priorities — the more important the higher the priority. Less important sounds (background music) should have negative priorities. This will allow sound effects to override background music (which will resume at the appropriate point) and error beeps to override sound effects.</blockquote> | ||
+ | |||
+ | ==== signal ==== | ||
+ | <blockquote>This is a bit-mapped property used to set characteristics of the sound. Its bits are defined in base.sh. Only one bit, blockingSnd, is currently defined. When it is set, the sound blocks when it is playing — all game play stops until the sound is complete. Sampled sound effects are blocking sounds by default, and needn't have this bit set.</blockquote> | ||
+ | </blockquote> | ||
+ | |||
+ | ===<br /> Methods === | ||
+ | |||
+ | <blockquote> | ||
+ | ==== init: ==== | ||
+ | <blockquote>Initialize the sound and set any appropriate bits in signal to indicate the sound's nature.</blockquote> | ||
+ | |||
+ | ==== play: ==== | ||
+ | <blockquote>Start the sound playing and add it to sounds, the list of sounds which are playing.</blockquote> | ||
+ | |||
+ | ==== dispose: ==== | ||
+ | <blockquote>Stop the sound.</blockquote> | ||
+ | </blockquote> | ||
| |
Latest revision as of 02:02, 11 December 2015
Chapter:
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
Index
The Sound Class
This is the class which allows sound to be played.
In file: | game.sc |
Inherits from: | Object |
Inherited by: | none |
Properties
done
Set to TRUE after the sound has finished playing, FALSE while it is playing.
number
The number of the sound.
priority
The priority of the sound if multiple sounds are playing. Most sound effects should have the default priority of 0. More important sounds (say an error beep) should have positive priorities — the more important the higher the priority. Less important sounds (background music) should have negative priorities. This will allow sound effects to override background music (which will resume at the appropriate point) and error beeps to override sound effects.
signal
This is a bit-mapped property used to set characteristics of the sound. Its bits are defined in base.sh. Only one bit, blockingSnd, is currently defined. When it is set, the sound blocks when it is playing — all game play stops until the sound is complete. Sampled sound effects are blocking sounds by default, and needn't have this bit set.
Methods
init:
Initialize the sound and set any appropriate bits in signal to indicate the sound's nature.
play:
Start the sound playing and add it to sounds, the list of sounds which are playing.
dispose:
Stop the sound.
- Notes
< Previous: The Cage Class Next: The StatusLine Class >