-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Issue-139: Add all music tracks, Implemented AudioManager, Add playing music when starting a new game * Issue-139: Loop music tracks, Add cicadas track to Main Menu
- Loading branch information
1 parent
ac4807f
commit fe436c2
Showing
24 changed files
with
305 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
extends Control | ||
|
||
func _ready() -> void: | ||
AudioManager.start_music(GlobalEnums.MusicTrack.HEAL) | ||
SaveManager.execute_save() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[remap] | ||
|
||
importer="wav" | ||
type="AudioStreamWAV" | ||
uid="uid://bcul2j5636jou" | ||
path="res://.godot/imported/area_1.wav-2c34baa1e3757ba46478140199d2135e.sample" | ||
|
||
[deps] | ||
|
||
source_file="res://Audio/Battle/area_1.wav" | ||
dest_files=["res://.godot/imported/area_1.wav-2c34baa1e3757ba46478140199d2135e.sample"] | ||
|
||
[params] | ||
|
||
force/8_bit=false | ||
force/mono=false | ||
force/max_rate=false | ||
force/max_rate_hz=44100 | ||
edit/trim=false | ||
edit/normalize=false | ||
edit/loop_mode=2 | ||
edit/loop_begin=0 | ||
edit/loop_end=-1 | ||
compress/mode=0 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[remap] | ||
|
||
importer="wav" | ||
type="AudioStreamWAV" | ||
uid="uid://c1l85a2sb0uvx" | ||
path="res://.godot/imported/area_2.wav-1fe080959541db71ffe9c331b81c4fb5.sample" | ||
|
||
[deps] | ||
|
||
source_file="res://Audio/Battle/area_2.wav" | ||
dest_files=["res://.godot/imported/area_2.wav-1fe080959541db71ffe9c331b81c4fb5.sample"] | ||
|
||
[params] | ||
|
||
force/8_bit=false | ||
force/mono=false | ||
force/max_rate=false | ||
force/max_rate_hz=44100 | ||
edit/trim=false | ||
edit/normalize=false | ||
edit/loop_mode=2 | ||
edit/loop_begin=0 | ||
edit/loop_end=-1 | ||
compress/mode=0 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[remap] | ||
|
||
importer="wav" | ||
type="AudioStreamWAV" | ||
uid="uid://c87sumxo08tbt" | ||
path="res://.godot/imported/area_3.wav-e75c187215113b3d3dba7cc6f9d09a31.sample" | ||
|
||
[deps] | ||
|
||
source_file="res://Audio/Battle/area_3.wav" | ||
dest_files=["res://.godot/imported/area_3.wav-e75c187215113b3d3dba7cc6f9d09a31.sample"] | ||
|
||
[params] | ||
|
||
force/8_bit=false | ||
force/mono=false | ||
force/max_rate=false | ||
force/max_rate_hz=44100 | ||
edit/trim=false | ||
edit/normalize=false | ||
edit/loop_mode=2 | ||
edit/loop_begin=0 | ||
edit/loop_end=-1 | ||
compress/mode=0 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[remap] | ||
|
||
importer="wav" | ||
type="AudioStreamWAV" | ||
uid="uid://dv22f2psd5s2u" | ||
path="res://.godot/imported/boss_1.wav-0297eb94cdd4630efa5f828b2e37dc8f.sample" | ||
|
||
[deps] | ||
|
||
source_file="res://Audio/Battle/boss_1.wav" | ||
dest_files=["res://.godot/imported/boss_1.wav-0297eb94cdd4630efa5f828b2e37dc8f.sample"] | ||
|
||
[params] | ||
|
||
force/8_bit=false | ||
force/mono=false | ||
force/max_rate=false | ||
force/max_rate_hz=44100 | ||
edit/trim=false | ||
edit/normalize=false | ||
edit/loop_mode=2 | ||
edit/loop_begin=0 | ||
edit/loop_end=-1 | ||
compress/mode=0 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[remap] | ||
|
||
importer="wav" | ||
type="AudioStreamWAV" | ||
uid="uid://dn4vvohka34oa" | ||
path="res://.godot/imported/cicadas.wav-dcbeb09c6e6173bc4f40cabe17efe450.sample" | ||
|
||
[deps] | ||
|
||
source_file="res://Audio/MainMenu/cicadas.wav" | ||
dest_files=["res://.godot/imported/cicadas.wav-dcbeb09c6e6173bc4f40cabe17efe450.sample"] | ||
|
||
[params] | ||
|
||
force/8_bit=false | ||
force/mono=false | ||
force/max_rate=false | ||
force/max_rate_hz=44100 | ||
edit/trim=false | ||
edit/normalize=false | ||
edit/loop_mode=2 | ||
edit/loop_begin=0 | ||
edit/loop_end=-1 | ||
compress/mode=0 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[remap] | ||
|
||
importer="wav" | ||
type="AudioStreamWAV" | ||
uid="uid://dg6gyqm1ejosu" | ||
path="res://.godot/imported/heal.wav-5ab6d90a27f406b6b2d2e28cb6291aa4.sample" | ||
|
||
[deps] | ||
|
||
source_file="res://Audio/World/heal.wav" | ||
dest_files=["res://.godot/imported/heal.wav-5ab6d90a27f406b6b2d2e28cb6291aa4.sample"] | ||
|
||
[params] | ||
|
||
force/8_bit=false | ||
force/mono=false | ||
force/max_rate=false | ||
force/max_rate_hz=44100 | ||
edit/trim=false | ||
edit/normalize=false | ||
edit/loop_mode=2 | ||
edit/loop_begin=0 | ||
edit/loop_end=-1 | ||
compress/mode=0 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[remap] | ||
|
||
importer="wav" | ||
type="AudioStreamWAV" | ||
uid="uid://cpbi46kxjtqm7" | ||
path="res://.godot/imported/shop.wav-cb470f972d3892abc362f53b8b54009b.sample" | ||
|
||
[deps] | ||
|
||
source_file="res://Audio/World/shop.wav" | ||
dest_files=["res://.godot/imported/shop.wav-cb470f972d3892abc362f53b8b54009b.sample"] | ||
|
||
[params] | ||
|
||
force/8_bit=false | ||
force/mono=false | ||
force/max_rate=false | ||
force/max_rate_hz=44100 | ||
edit/trim=false | ||
edit/normalize=false | ||
edit/loop_mode=2 | ||
edit/loop_begin=0 | ||
edit/loop_end=-1 | ||
compress/mode=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
extends Node | ||
|
||
|
||
# Music | ||
var battle_area_1: AudioStream = preload("res://Audio/Battle/area_1.wav") | ||
var battle_area_2: AudioStream = preload("res://Audio/Battle/area_2.wav") | ||
var battle_area_3: AudioStream = preload("res://Audio/Battle/area_3.wav") | ||
var boss: AudioStream = preload("res://Audio/Battle/boss_1.wav") | ||
var heal_event: AudioStream = preload("res://Audio/World/heal.wav") | ||
var shop_event: AudioStream = preload("res://Audio/World/shop.wav") | ||
var main_menu: AudioStream = preload("res://Audio/MainMenu/cicadas.wav") | ||
|
||
var music_dictionary: Dictionary = { | ||
GlobalEnums.MusicTrack.AREA_ONE: battle_area_1, | ||
GlobalEnums.MusicTrack.AREA_TWO: battle_area_2, | ||
GlobalEnums.MusicTrack.AREA_THREE: battle_area_3, | ||
GlobalEnums.MusicTrack.BOSS: boss, | ||
GlobalEnums.MusicTrack.HEAL: heal_event, | ||
GlobalEnums.MusicTrack.SHOP: shop_event, | ||
GlobalEnums.MusicTrack.MAIN_MENU: main_menu | ||
} | ||
|
||
# SFX | ||
var uuuuu: AudioStream = preload("res://Audio/fauna_uuu_test.mp3") | ||
|
||
var sfx_dictionary: Dictionary = { | ||
GlobalEnums.SoundEffect.UUUUU: uuuuu | ||
} | ||
|
||
var music_stream: AudioStreamPlayer = AudioStreamPlayer.new() | ||
var sfx_stream: AudioStreamPlayer = AudioStreamPlayer.new() | ||
|
||
var current_song: GlobalEnums.MusicTrack = GlobalEnums.MusicTrack.NO_TRACK | ||
|
||
func _ready() -> void: | ||
add_child(music_stream) | ||
add_child(sfx_stream) | ||
|
||
func start_music(song: GlobalEnums.MusicTrack) -> void: | ||
if current_song == song or song == GlobalEnums.MusicTrack.NO_TRACK: | ||
return | ||
|
||
if music_stream.playing and current_song != song: | ||
var volume_tween: Tween = create_tween() | ||
volume_tween.tween_property(music_stream, "volume_db", -100, 1) | ||
volume_tween.tween_callback(_on_volume_fade_finished.bind(song)) | ||
else: | ||
_on_volume_fade_finished(song) | ||
|
||
func stop_music() -> void: | ||
var volume_tween: Tween = create_tween() | ||
volume_tween.tween_property(music_stream, "volume_db", -100, 0.25) | ||
volume_tween.tween_callback(_on_volume_fade_stop) | ||
|
||
func _on_volume_fade_stop() -> void: | ||
current_song = GlobalEnums.MusicTrack.NO_TRACK | ||
music_stream.volume_db = 0 | ||
music_stream.stop() | ||
|
||
func _on_volume_fade_finished(song: GlobalEnums.MusicTrack) -> void: | ||
music_stream.stream = _get_music_track(song) | ||
music_stream.volume_db = 0 | ||
music_stream.play() | ||
current_song = song | ||
|
||
func _get_music_track(song: GlobalEnums.MusicTrack) -> AudioStream: | ||
return music_dictionary[song] | ||
|
||
func play_sfx(sfx: GlobalEnums.SoundEffect) -> void: | ||
sfx_stream.stream = _get_sound_effect(sfx) | ||
sfx_stream.volume_db = 0 | ||
sfx_stream.play() | ||
|
||
func _get_sound_effect(sfx: GlobalEnums.SoundEffect) -> AudioStream: | ||
return sfx_dictionary[sfx] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters