diff --git a/assets/bgm/ending_music.ogg b/assets/bgm/ending_music.ogg new file mode 100644 index 0000000..e29d8bc Binary files /dev/null and b/assets/bgm/ending_music.ogg differ diff --git a/assets/bgm/ending_music.ogg.import b/assets/bgm/ending_music.ogg.import new file mode 100644 index 0000000..741d20f --- /dev/null +++ b/assets/bgm/ending_music.ogg.import @@ -0,0 +1,18 @@ +[remap] + +importer="ogg_vorbis" +type="AudioStreamOGGVorbis" +path="res://.import/ending_music.ogg-b5c9174cd3b9e6fc5d5275799b93d222.oggstr" + +[deps] + +source_file="res://assets/bgm/ending_music.ogg" +source_md5="bfab6c911c2a4b8168649865defb3045" + +dest_files=[ "res://.import/ending_music.ogg-b5c9174cd3b9e6fc5d5275799b93d222.oggstr" ] +dest_md5="53966eef73348be9f470d555827b0bd7" + +[params] + +loop=true +loop_offset=0 diff --git a/assets/bgm/main_menu_music.ogg b/assets/bgm/main_menu_music.ogg new file mode 100644 index 0000000..aba1291 Binary files /dev/null and b/assets/bgm/main_menu_music.ogg differ diff --git a/assets/bgm/main_menu_music.ogg.import b/assets/bgm/main_menu_music.ogg.import new file mode 100644 index 0000000..bad1722 --- /dev/null +++ b/assets/bgm/main_menu_music.ogg.import @@ -0,0 +1,18 @@ +[remap] + +importer="ogg_vorbis" +type="AudioStreamOGGVorbis" +path="res://.import/main_menu_music.ogg-f9ddafbd7b8511d8b685e06768b80318.oggstr" + +[deps] + +source_file="res://assets/bgm/main_menu_music.ogg" +source_md5="912629009a4f170b5b0de9d82cb0eefa" + +dest_files=[ "res://.import/main_menu_music.ogg-f9ddafbd7b8511d8b685e06768b80318.oggstr" ] +dest_md5="f9cff7ce58e5c14da0f662cc8f146683" + +[params] + +loop=true +loop_offset=0 diff --git a/bgm.tscn b/bgm.tscn index eb3d518..ecd218e 100644 --- a/bgm.tscn +++ b/bgm.tscn @@ -1,8 +1,25 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=3 format=2] -[ext_resource path="res://assets/bgm/background_music.ogg" type="AudioStream" id=1] +[ext_resource path="res://assets/bgm/ending_music.ogg" type="AudioStream" id=1] +[sub_resource type="Animation" id=1] +resource_name = "fade" +length = 1.0 +loop = false +step = 0.1 +tracks/0/type = "value" +tracks/0/path = NodePath(".:volume_db") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 1 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ -24.0, -4.0 ] +} [node name="bgm" type="AudioStreamPlayer"] @@ -12,4 +29,14 @@ autoplay = false mix_target = 0 bus = "bgm" +[node name="animator" type="AnimationPlayer" parent="." index="0"] + +root_node = NodePath("..") +autoplay = "" +playback_process_mode = 1 +playback_default_blend_time = 0.0 +playback_speed = 1.0 +anims/fade = SubResource( 1 ) +blend_times = [ ] + diff --git a/levels/level_00.gd b/levels/level_00.gd index acd0756..31ae5ab 100644 --- a/levels/level_00.gd +++ b/levels/level_00.gd @@ -2,8 +2,13 @@ extends Node2D export (String, FILE, "*.tscn") var next_level export (String, FILE, "*.tscn") var current_level export (int) var min_score = 0 +const BGM_MUSIC = preload("res://assets/bgm/background_music.ogg") func _ready(): + if !bgm.stream == BGM_MUSIC: + bgm.stream = BGM_MUSIC + bgm.get_node("animator").play("fade") + bgm.play() $rocket.set_minimum_score(min_score) score_container.next_level = next_level score_container.current_level = current_level diff --git a/levels/level_06.tscn b/levels/level_06.tscn index 202c3bd..8d4abfd 100644 --- a/levels/level_06.tscn +++ b/levels/level_06.tscn @@ -5,7 +5,7 @@ [ext_resource path="res://actors/enemies/boss_bug/boss_bug.tscn" type="PackedScene" id=3] [ext_resource path="res://actors/enemies/ground_bug.tscn" type="PackedScene" id=4] -[node name="level_00" index="0" instance=ExtResource( 1 )] +[node name="level_00" instance=ExtResource( 1 )] next_level = "res://screens/promo_screen/promo_screen.tscn" current_level = "res://levels/level_06.tscn" @@ -34,12 +34,10 @@ editor/display_folded = true [node name="boss_bug" parent="bugs" index="1" instance=ExtResource( 3 )] position = Vector2( 1592, 464 ) -penalty = 5 [node name="ground_bug" parent="bugs" index="2" instance=ExtResource( 4 )] position = Vector2( 736, 520 ) -penalty = 5 [editable path="juan"] diff --git a/screens/main_menu/main_screen.gd b/screens/main_menu/main_screen.gd index 574d7a9..75630ad 100644 --- a/screens/main_menu/main_screen.gd +++ b/screens/main_menu/main_screen.gd @@ -1,10 +1,13 @@ extends "res://screens/basic_screen.gd" var can_play = false +const BGM_MUSIC = preload("res://assets/bgm/main_menu_music.ogg") func _ready(): var bus = AudioServer.get_bus_index("bgm") $bgm_volume.value = AudioServer.get_bus_volume_db(bus) bus = AudioServer.get_bus_index("sfx") $sfx_volume.value = AudioServer.get_bus_volume_db(bus) + if !bgm.stream == BGM_MUSIC: + bgm.stream = BGM_MUSIC if !bgm.is_playing(): bgm.play() diff --git a/screens/promo_screen/promo_screen.tscn b/screens/promo_screen/promo_screen.tscn index d0c6ad1..babd041 100644 --- a/screens/promo_screen/promo_screen.tscn +++ b/screens/promo_screen/promo_screen.tscn @@ -27,8 +27,14 @@ script/source = "extends HBoxContainer const BRIGHT = Color(1.1, 1.1, 1.1) const DARK = Color(0.8, 0.8, 0.8) - +const BGM_MUSIC = preload(\"res://assets/bgm/ending_music.ogg\") func _ready(): + bgm.get_node(\"animator\").play_backwards(\"fade\") + yield(bgm.get_node(\"animator\"), \"animation_finished\") + bgm.stream = BGM_MUSIC + bgm.play() + bgm.get_node(\"animator\").play(\"fade\") + for c in get_children(): c.connect(\"focus_entered\", self, \"bright\", [c]) c.connect(\"button_down\", self, \"darker\", [c]) @@ -48,9 +54,9 @@ func darker(button): func open_link(link): OS.shell_open(link)" -[node name="promo_screen" instance=ExtResource( 1 )] +[node name="promo_screen" index="0" instance=ExtResource( 1 )] -next_scene = "res://levels/level_01.tscn" +next_scene = "res://screens/main_menu/main_screen.tscn" [node name="background" type="TextureRect" parent="." index="0"]