Skip to content

Commit 496a6e0

Browse files
feat(public): play sound waves in the background
1 parent 460aef8 commit 496a6e0

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ Play the game on:
1717

1818
## Credits
1919

20-
- [Kenney Puzzle Pack 2](https://kenney.nl/assets/puzzle-pack-2)
21-
- [Kenney UI Audio](https://kenney.nl/assets/ui-audio)
22-
- [SPLASH by Pixabay](https://pixabay.com/sound-effects/splash-by-blaukreuz-6261/)
20+
- [Kenney - Puzzle Pack 2](https://kenney.nl/assets/puzzle-pack-2)
21+
- [Kenney - UI Audio](https://kenney.nl/assets/ui-audio)
22+
- [Pixabay - SPLASH](https://pixabay.com/sound-effects/splash-by-blaukreuz-6261/)
23+
- [Pixabay - Gentle ocean waves birdsong and gull](https://pixabay.com/sound-effects/gentle-ocean-waves-birdsong-and-gull-7109/)
2324

2425
## Stack
2526

public/sounds/waves.mp3

2.2 MB
Binary file not shown.

src/constants/sounds.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export enum Sound {
22
click = 'click',
33
splash = 'splash',
4+
waves = 'waves',
45
}

src/scenes/game.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ scene(Scene.game, (levelNumber: number) => {
1212
levelNumber = 0
1313
}
1414

15+
play(Sound.waves, { loop: true, volume: 0.4 })
16+
1517
add([
1618
text(String(levelNumber), {
1719
align: 'center',
@@ -37,7 +39,7 @@ scene(Scene.game, (levelNumber: number) => {
3739
}
3840

3941
if (checkSolution(level)) {
40-
play(Sound.splash)
42+
play(Sound.splash, { volume: 0.5 })
4143

4244
level.get(Tag.pipe).forEach((pipe) => {
4345
pipe.use(

0 commit comments

Comments
 (0)