Add BGM levels

This commit is contained in:
Hamcha 2019-07-06 02:15:43 +02:00
parent f7c14e668d
commit ed1099616f
Signed by: hamcha
GPG Key ID: A40413D21021EAEE
8 changed files with 111 additions and 19 deletions

View File

@ -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]

View File

@ -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()
play()
func set_volume(vol: float):
var idx := AudioServer.get_bus_index("BGM")
AudioServer.set_bus_volume_db(idx, vol)

View File

@ -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")

View File

@ -4,6 +4,7 @@ signal loaded()
func _ready():
# Load bgm
BGM.set_volume(BGM.LOW)
BGM.load_music("deckbuilder")
emit_signal("loaded")

View File

@ -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

View File

@ -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

View File

@ -1,9 +0,0 @@
extends Control
signal loaded()
func _ready():
emit_signal("loaded")
func _anim_finished(anim_name):
pass

View File

@ -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"]