diff --git a/Scenes/Lobby.tscn b/Scenes/Lobby.tscn index 67b0943..d7f7507 100644 --- a/Scenes/Lobby.tscn +++ b/Scenes/Lobby.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=6 format=2] -[ext_resource path="res://Scenes/Lobby.gd" type="Script" id=1] +[ext_resource path="res://Scenes/Scripts/Lobby.gd" type="Script" id=1] [ext_resource path="res://MLPAssets/Background/menubg.webp" type="Texture" id=2] [ext_resource path="res://UIAssets/Fonts/Catamaran.tres" type="DynamicFont" id=3] [ext_resource path="res://UIAssets/Fonts/Catamaran-Light.ttf" type="DynamicFontData" id=4] diff --git a/Scenes/Scripts/BGMusic.gd b/Scenes/Scripts/BGMusic.gd index 1d96880..369c235 100644 --- a/Scenes/Scripts/BGMusic.gd +++ b/Scenes/Scripts/BGMusic.gd @@ -1,5 +1,8 @@ extends AudioStreamPlayer +const LOW: float = -8.0; +const HIGH: float = 0.0; + func load_music(name: String): # Calculate track path var path := "res://Music/%s.ogg" % name @@ -14,4 +17,8 @@ func load_music(name: String): bgmstream.data = bytes stop() stream = bgmstream - play() \ No newline at end of file + play() + +func set_volume(vol: float): + var idx := AudioServer.get_bus_index("BGM") + AudioServer.set_bus_volume_db(idx, vol) \ No newline at end of file diff --git a/Scenes/Scripts/Board.gd b/Scenes/Scripts/Board.gd index 637c8a1..df3bf8a 100644 --- a/Scenes/Scripts/Board.gd +++ b/Scenes/Scripts/Board.gd @@ -35,6 +35,7 @@ onready var zones: Dictionary = { func _ready(): # Load bgm + BGM.set_volume(BGM.LOW) BGM.load_music("ingame3") # Sample deck var deck = [ @@ -52,7 +53,7 @@ func _ready(): #TODO Draw cards from deck for i in range(0,6): draw_card(0, "player1.deck") - + for i in range(0,6): draw_card(1, "player1.deck") diff --git a/Scenes/Scripts/DeckBuilder.gd b/Scenes/Scripts/DeckBuilder.gd index 5142d26..4ef660c 100644 --- a/Scenes/Scripts/DeckBuilder.gd +++ b/Scenes/Scripts/DeckBuilder.gd @@ -4,6 +4,7 @@ signal loaded() func _ready(): # Load bgm + BGM.set_volume(BGM.LOW) BGM.load_music("deckbuilder") - + emit_signal("loaded") \ No newline at end of file diff --git a/Scenes/Lobby.gd b/Scenes/Scripts/Lobby.gd similarity index 96% rename from Scenes/Lobby.gd rename to Scenes/Scripts/Lobby.gd index 9a8cf8a..69ff8a1 100644 --- a/Scenes/Lobby.gd +++ b/Scenes/Scripts/Lobby.gd @@ -8,6 +8,7 @@ var RoomItem := preload("res://Scenes/Lobby/RoomEntry.tscn") func _ready(): # Load bgm + BGM.set_volume(BGM.LOW) BGM.load_music("lobby") emit_signal("loaded") Server.get_rooms(self, "_room_list") @@ -19,7 +20,7 @@ func add_room(id: String, name: String): item.roomName = name item.connect("clicked", self, "_room_clicked", [id]) roomList.add_child(item) - + func _room_list(result, obj): if result != OK: # Handle error diff --git a/Scenes/Scripts/TitleScreen.gd b/Scenes/Scripts/TitleScreen.gd new file mode 100644 index 0000000..36ad402 --- /dev/null +++ b/Scenes/Scripts/TitleScreen.gd @@ -0,0 +1,14 @@ +extends Control + +signal loaded() + +func _ready(): + emit_signal("loaded") + +func _anim_finished(anim_name): + if anim_name == "FadeIn": + $Intro/AnimationPlayer.play("FadeTitle") + # Load bgm + BGM.set_volume(BGM.HIGH) + BGM.load_music("title") + pass \ No newline at end of file diff --git a/Scenes/TitleScreen.gd b/Scenes/TitleScreen.gd deleted file mode 100644 index d7631a8..0000000 --- a/Scenes/TitleScreen.gd +++ /dev/null @@ -1,9 +0,0 @@ -extends Control - -signal loaded() - -func _ready(): - emit_signal("loaded") - -func _anim_finished(anim_name): - pass \ No newline at end of file diff --git a/Scenes/TitleScreen.tscn b/Scenes/TitleScreen.tscn index 2344134..9c6c741 100644 --- a/Scenes/TitleScreen.tscn +++ b/Scenes/TitleScreen.tscn @@ -1,6 +1,6 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=9 format=2] -[ext_resource path="res://Scenes/TitleScreen.gd" type="Script" id=1] +[ext_resource path="res://Scenes/Scripts/TitleScreen.gd" type="Script" id=1] [ext_resource path="res://UIAssets/mane6start.png" type="Texture" id=2] [ext_resource path="res://UIAssets/Sounds/Swoosh.wav" type="AudioStream" id=3] [ext_resource path="res://UIAssets/Sounds/TWRise.wav" type="AudioStream" id=4] @@ -210,8 +210,71 @@ tracks/14/keys = { "update": 0, "values": [ 0.0, 0.0, 1.0 ] } +tracks/15/type = "value" +tracks/15/path = NodePath("Title/ColorRect2:visible") +tracks/15/interp = 1 +tracks/15/loop_wrap = true +tracks/15/imported = false +tracks/15/enabled = true +tracks/15/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} +tracks/16/type = "value" +tracks/16/path = NodePath("Intro:visible") +tracks/16/interp = 1 +tracks/16/loop_wrap = true +tracks/16/imported = false +tracks/16/enabled = true +tracks/16/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ true ] +} -[sub_resource type="ShaderMaterial" id=2] +[sub_resource type="Animation" id=2] +resource_name = "FadeTitle" +tracks/0/type = "value" +tracks/0/path = NodePath("Intro:visible") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("Title:visible") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ true ] +} +tracks/2/type = "value" +tracks/2/path = NodePath("Title/ColorRect2:modulate") +tracks/2/interp = 2 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0, 0.5 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ] +} + +[sub_resource type="ShaderMaterial" id=3] shader = ExtResource( 5 ) shader_param/effect_strength = 0.0 @@ -226,7 +289,9 @@ margin_right = 640.0 margin_bottom = 400.0 script = ExtResource( 1 ) -[node name="Intro" type="Node" parent="."] +[node name="Intro" type="Control" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 [node name="RD" type="Sprite" parent="Intro"] modulate = Color( 1, 1, 1, 0 ) @@ -280,6 +345,7 @@ region_rect = Rect2( 429.027, 395.82, 401.907, 578.254 ) root_node = NodePath("../..") autoplay = "FadeIn" anims/FadeIn = SubResource( 1 ) +anims/FadeTitle = SubResource( 2 ) [node name="Channel1" type="AudioStreamPlayer2D" parent="Intro"] stream = ExtResource( 3 ) @@ -290,7 +356,18 @@ stream = ExtResource( 4 ) bus = "SFX" [node name="ColorRect" type="ColorRect" parent="Intro"] -material = SubResource( 2 ) +material = SubResource( 3 ) +anchor_right = 1.0 +anchor_bottom = 1.0 + +[node name="Title" type="Control" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 + +[node name="ColorRect2" type="ColorRect" parent="Title"] +visible = false +modulate = Color( 1, 1, 1, 0 ) +material = SubResource( 3 ) anchor_right = 1.0 anchor_bottom = 1.0 [connection signal="animation_finished" from="Intro/AnimationPlayer" to="." method="_anim_finished"]