Game Development Reference
In-Depth Information
Click here to view code image
class SoundCue
string name
int falloff
int priority
// List of strings of all the sources
List sources ;
function Play()
// Randomly select from sources and play
...
end
end
The preceding system might be sufficient for many games, but for the footstep
example it may not be enough. If the character can run across different sur-
faces—stone, sand, grass, and so on—different sound effects must play depending
on what surface the character currently is on. In this case, the system needs some
way to categorize the different sounds and then randomly select from the correct
category based on the current surface. Or in other words, the system needs some
way to switch between the different sets of source data based on the current sur-
face.
The JSON file for this more advanced type of cue might look like this:
Click here to view code image
{
"name": "footstep",
"falloff": 25,
"priority": "low",
"switch_name": "foot_surface",
"sources":
[
{
"switch": "sand",
"sources":
[
Search WWH ::




Custom Search