forked from Syllenze/Blitz3D-Sonic-World-Engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Adding Sounds
Roy Flaherty edited this page Apr 6, 2024
·
2 revisions
To add sound files, to the code you can follow this design pattern.
Sonic World puts all of its sounds in one Sounds folder at the root directory.
- Declare the sound in
Game_Resources_Sounds_Info.bb
The cm is used for iteration of all the sounds.
2. To assign the sound, introduce it in the LoadSmartSound()
method in the Game_Resources_Sounds.bb
LoadGoodSound is used as it is a method that plays the sound in 3D or 2D depending on if 3D sound is enabled, and respects the volume options.
The number 3
is used for any sounds affected by 3D sounds. 2D sounds use 1
.
- To use this sound in a function, you call it as follows
EmitSmartSound(Sound_InstaShield,p\Objects\Entity)
EmitSmartSound emits a sound at a certain position. In this case it plays the Instashield sound at the player's position.
You can assign sounds to fields, or channels, for more control on the sound, and to have sounds support looping and playing over other sounds.
- Add a field for your channel in the relevant area. This is a player channel so it'll be in the player type.
- Load a sound into the channel by making it equal to EmitSmartSound like follows:
p\Channel_Stomp = EmitSmartSound(Sound_Stomp,p\Objects\Entity)
- Add the channel to the PauseAllChannels and ResumeAllChannels function in
Stage_Exit.bb
Following all these steps a working sound should be in-game!