Skip to content

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.

Location

Sonic World puts all of its sounds in one Sounds folder at the root directory.

Adding new Sounds

  1. Declare the sound in Game_Resources_Sounds_Info.bb

image

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

image

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.

  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.

Sound Channels

image

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.

  1. Add a field for your channel in the relevant area. This is a player channel so it'll be in the player type.
  2. Load a sound into the channel by making it equal to EmitSmartSound like follows: p\Channel_Stomp = EmitSmartSound(Sound_Stomp,p\Objects\Entity)
  3. Add the channel to the PauseAllChannels and ResumeAllChannels function in Stage_Exit.bb

image

image

Following all these steps a working sound should be in-game!

Clone this wiki locally