Line 11: |
Line 11: |
| | | |
| ===Playing client-side sounds=== | | ===Playing client-side sounds=== |
− | <dt><tt>playSound</tt></dt> | + | <dt><tt>Game1.playSound</tt></dt> |
| <dd> | | <dd> |
| You can play a sound for the current player only, played from no specific location, by calling the <tt>Game1.playSound()</tt> method. For example: | | You can play a sound for the current player only, played from no specific location, by calling the <tt>Game1.playSound()</tt> method. For example: |
Line 21: |
Line 21: |
| </dd> | | </dd> |
| | | |
− | <dt><tt>localSound</tt></dt> | + | <dt><tt>GameLocation.localSound</tt></dt> |
| <dd> | | <dd> |
| Similarly, you can play a sound for the current player only, played from a specific map, by calling the <tt>GameLocation.localSound()</tt> method: | | Similarly, you can play a sound for the current player only, played from a specific map, by calling the <tt>GameLocation.localSound()</tt> method: |
Line 34: |
Line 34: |
| </dd> | | </dd> |
| | | |
− | <dt><tt>localSoundAt</tt></dt> | + | <dt><tt>GameLocation.localSoundAt</tt></dt> |
| <dd> | | <dd> |
| This works just like the <tt>localSound</tt> method, except that it plays spatial audio, and will adjust the played sound's volume and position based on its proximity from the player. Sounds played from <tt>GameLocation.localSoundAt()</tt> will not be heard if the provided position is off-screen. | | This works just like the <tt>localSound</tt> method, except that it plays spatial audio, and will adjust the played sound's volume and position based on its proximity from the player. Sounds played from <tt>GameLocation.localSoundAt()</tt> will not be heard if the provided position is off-screen. |
Line 54: |
Line 54: |
| </dd> | | </dd> |
| | | |
− | <dt><tt>playSoundPitched</tt></dt> | + | <dt><tt>Game1.playSoundPitched</tt></dt> |
| <dd> | | <dd> |
| If desired, you can pitch shift a sound at intervals of 100 per half step, with 1200 being the pitch of the original sample. | | If desired, you can pitch shift a sound at intervals of 100 per half step, with 1200 being the pitch of the original sample. |
Line 80: |
Line 80: |
| </dd> | | </dd> |
| | | |
− | <dt><tt>playSoundAfterDelay</tt></dt> | + | <dt><tt>DelayedAction.playSoundAfterDelay</tt></dt> |
| <dd> | | <dd> |
| Sometimes, you need to play a sound after waiting a certain period of time, for the current player at no particular location. In this case, you can call the <tt>DelayedAction.playSoundAfterDelay()</tt> method: | | Sometimes, you need to play a sound after waiting a certain period of time, for the current player at no particular location. In this case, you can call the <tt>DelayedAction.playSoundAfterDelay()</tt> method: |
Line 120: |
Line 120: |
| <dt><tt>GameLocation.playSound</tt></dt> | | <dt><tt>GameLocation.playSound</tt></dt> |
| <dd> | | <dd> |
− | This method will play a sound for all players located in the same map, but not from a particular position: | + | This method will play a sound for all players located on the same map, but not from a particular position: |
| <syntaxhighlight lang="c#"> | | <syntaxhighlight lang="c#"> |
| // When a player places a new structure, a sound will be played | | // When a player places a new structure, a sound will be played |
Line 133: |
Line 133: |
| </dd> | | </dd> |
| | | |
− | <dt><tt>playSoundAt</tt></dt> | + | <dt><tt>GameLocation.playSoundAt</tt></dt> |
| <dd> | | <dd> |
| Like <tt>localSoundAt</tt>, this method can be used to play sounds spatially at a specific map and location, and will adjust the played sound's volume and position based on its proximity from a nearby player. A player will not hear any sound played from the <tt>GameLocation.playSoundAt()</tt> method if the provided position is off-screen: | | Like <tt>localSoundAt</tt>, this method can be used to play sounds spatially at a specific map and location, and will adjust the played sound's volume and position based on its proximity from a nearby player. A player will not hear any sound played from the <tt>GameLocation.playSoundAt()</tt> method if the provided position is off-screen: |