Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anthonyec/godot_sfx
Godot plugin that makes it easy to play sounds from code without needing to create nodes
https://github.com/anthonyec/godot_sfx
gdscript godot plugin
Last synced: about 1 month ago
JSON representation
Godot plugin that makes it easy to play sounds from code without needing to create nodes
- Host: GitHub
- URL: https://github.com/anthonyec/godot_sfx
- Owner: anthonyec
- Created: 2023-03-12T17:55:38.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-06T08:58:00.000Z (about 1 year ago)
- Last Synced: 2024-11-01T17:05:31.648Z (3 months ago)
- Topics: gdscript, godot, plugin
- Language: GDScript
- Homepage:
- Size: 1.21 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SFX
⚠️ I haven't officially "released" this yet, so some things may change a lot.
## Installation
- Use Godot 4+
- Install the plugin in the Addons folder
- Enable it in `Project Settings > Addons`## Setup
![Screenshot of SFX in Project Settings](./screenshot.png)
1. Go to `Project > Project Settings...`
2. Turn on "Advanced Settings"
3. In the list, go to `Addons > SFX` or search for "SFX"
4. For the sounds directory, choose a folder where all your sounds will live.## Usage
### Playing sounds
```gdscript
# Play a sound at a location
SFX.play_at_location("water_splash", Vector3(10, 20, 30))# Play a sound at attached to a node
SFX.play_attached_to_node("footstep", player)# Play a non-spatial sound that is not affected by process mode
SFX.play_everywhere("ui_select")
```### Random sounds
If you include sounds with file names that end with numbers, `SFX` can randomly
choose one and play it.For example, in my sounds directory I include the following files:
```txt
res://audio/sfx/footstep_1.wav
res://audio/sfx/footstep_2.wav
res://audio/sfx/footstep_3.wav
```Then when playing the sound, replace the number in the sound name with `[%n]`:
```gdscript
SFX.play_attached_to_node("footstep_[%n]", player)
```## Demo
[Download demo project](#)
### Credits
| Name | Link |
|---|---|
| chime.wav | [582649__ironcross32__long-rising-tones-14.wav](https://freesound.org/people/ironcross32/sounds/582649/) |
| wobble.wav | [268613__breo2012__pulse-bass.wav](https://freesound.org/people/breo2012/sounds/268613/) |
| boot_1.wav | [533044__nox-sound__footsteps-boots-wood.wav](https://freesound.org/people/Nox_Sound/sounds/533044/) |
| boot_2.wav | [533044__nox-sound__footsteps-boots-wood.wav](https://freesound.org/people/Nox_Sound/sounds/533044/) |
| boot_3.wav | [533044__nox-sound__footsteps-boots-wood.wav](https://freesound.org/people/Nox_Sound/sounds/533044/) |