Added music fade in and out
This commit is contained in:
@@ -43,13 +43,13 @@ distance = -432.0
|
||||
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_48dqy"]
|
||||
distance = -360.0
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_334al"]
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_kyxd5"]
|
||||
shader = ExtResource("12_ljnes")
|
||||
shader_parameter/rect_global_position = Vector2(0, 0.215385)
|
||||
shader_parameter/rect_size = Vector2(448, 25)
|
||||
shader_parameter/rect_global_position = Vector2(0, 0)
|
||||
shader_parameter/rect_size = Vector2(150, 25)
|
||||
shader_parameter/ColourTexture = ExtResource("13_u52d1")
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ldhlx"]
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_48a5y"]
|
||||
shader = ExtResource("12_ljnes")
|
||||
shader_parameter/rect_global_position = Vector2(0, 0)
|
||||
shader_parameter/rect_size = Vector2(89, 25)
|
||||
@@ -323,7 +323,7 @@ theme_type_variation = &"RoundStart"
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Title" type="Label" parent="Start/VBoxContainer/PanelContainer/VBoxContainer"]
|
||||
material = SubResource("ShaderMaterial_334al")
|
||||
material = SubResource("ShaderMaterial_kyxd5")
|
||||
layout_mode = 2
|
||||
theme = ExtResource("8_wcf7g")
|
||||
theme_type_variation = &"Arkanoid"
|
||||
@@ -371,7 +371,7 @@ size_flags_vertical = 3
|
||||
theme = ExtResource("8_wcf7g")
|
||||
|
||||
[node name="Label" type="Label" parent="Paused/VBoxContainer"]
|
||||
material = SubResource("ShaderMaterial_ldhlx")
|
||||
material = SubResource("ShaderMaterial_48a5y")
|
||||
layout_mode = 2
|
||||
theme = ExtResource("8_wcf7g")
|
||||
theme_type_variation = &"Arkanoid"
|
||||
|
||||
@@ -30,7 +30,8 @@ func _on_sub_viewport_container_scroll_finished() -> void:
|
||||
tween.finished.connect(_wait_load_intro)
|
||||
|
||||
func _wait_load_intro() -> void:
|
||||
Music.fade_down(3)
|
||||
get_tree().create_timer(3).timeout.connect(_load_intro)
|
||||
|
||||
func _load_intro() -> void:
|
||||
get_tree().change_scene_to_file("res://Intro.tscn")
|
||||
get_tree().change_scene_to_file("res://Intro.tscn")
|
||||
|
||||
@@ -9,16 +9,16 @@
|
||||
[ext_resource type="Script" path="res://ScrollText.gd" id="6_y6ajf"]
|
||||
[ext_resource type="Texture2D" uid="uid://c6nwmsoi1gjvv" path="res://FadeTex.png" id="7_wpqjt"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_sdln7"]
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_0d7e6"]
|
||||
shader = ExtResource("3_u76hk")
|
||||
shader_parameter/rect_global_position = Vector2(0, 0.104895)
|
||||
shader_parameter/rect_global_position = Vector2(0, 37.5)
|
||||
shader_parameter/rect_size = Vector2(640, 25)
|
||||
shader_parameter/ColourTexture = ExtResource("4_lxs2b")
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_fxm16"]
|
||||
shader = ExtResource("6_t71ub")
|
||||
shader_parameter/rect_global_position = Vector2(0.5, 0.37)
|
||||
shader_parameter/rect_size = Vector2(211, 96)
|
||||
shader_parameter/rect_global_position = Vector2(107, 107)
|
||||
shader_parameter/rect_size = Vector2(2532, 852)
|
||||
shader_parameter/ColourTexture = ExtResource("7_wpqjt")
|
||||
|
||||
[node name="GameOver" type="Node2D"]
|
||||
@@ -35,7 +35,7 @@ size_flags_vertical = 3
|
||||
theme = ExtResource("3_km2fx")
|
||||
|
||||
[node name="GameOver" type="Label" parent="VBoxContainer"]
|
||||
material = SubResource("ShaderMaterial_sdln7")
|
||||
material = SubResource("ShaderMaterial_0d7e6")
|
||||
layout_mode = 2
|
||||
theme = ExtResource("3_km2fx")
|
||||
theme_type_variation = &"Arkanoid"
|
||||
|
||||
4
Intro.gd
4
Intro.gd
@@ -78,13 +78,12 @@ func dump_all(dir : String, indent : String = "") -> void:
|
||||
|
||||
for file in DirAccess.get_files_at(dir):
|
||||
print("%s%s" % [indent, file])
|
||||
|
||||
|
||||
|
||||
func _on_play_level_pressed() -> void:
|
||||
$LoadPanel.show_panel(true)
|
||||
|
||||
func _on_load_panel_load_level(level_name: String) -> void:
|
||||
Music.fade_down(1)
|
||||
Global.start_level = level_name
|
||||
var tween = get_tree().create_tween()
|
||||
tween.tween_property($ColorRect, "color", Color(0, 0, 0, 1), 1)
|
||||
@@ -94,6 +93,7 @@ func _start_game() -> void:
|
||||
get_tree().change_scene_to_file("res://Dunkanoid.tscn")
|
||||
|
||||
func _on_button_pressed() -> void:
|
||||
Music.fade_down(1)
|
||||
Global.start_level = "DUNKANOID"
|
||||
var tween = get_tree().create_tween()
|
||||
tween.tween_property($ColorRect, "color", Color(0, 0, 0, 1), 1)
|
||||
|
||||
12
Intro.tscn
12
Intro.tscn
@@ -20,15 +20,15 @@ point_count = 2
|
||||
[sub_resource type="Gradient" id="Gradient_431mb"]
|
||||
colors = PackedColorArray(0, 0, 0, 0, 1, 1, 1, 1)
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_jnv6c"]
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_dkeyh"]
|
||||
shader = ExtResource("3_eo4f3")
|
||||
shader_parameter/rect_global_position = Vector2(0.19822, 0.0769231)
|
||||
shader_parameter/rect_global_position = Vector2(0, 0)
|
||||
shader_parameter/rect_size = Vector2(150, 25)
|
||||
shader_parameter/ColourTexture = ExtResource("4_v8i0c")
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_u0aoy"]
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_le8eo"]
|
||||
shader = ExtResource("3_eo4f3")
|
||||
shader_parameter/rect_global_position = Vector2(0.161003, 0.117483)
|
||||
shader_parameter/rect_global_position = Vector2(0, 0)
|
||||
shader_parameter/rect_size = Vector2(242, 25)
|
||||
shader_parameter/ColourTexture = ExtResource("4_v8i0c")
|
||||
|
||||
@@ -70,7 +70,7 @@ size_flags_horizontal = 3
|
||||
theme = ExtResource("3_8d2ix")
|
||||
|
||||
[node name="ArkaLabel" type="Label" parent="VBoxContainer/HBoxContainer"]
|
||||
material = SubResource("ShaderMaterial_jnv6c")
|
||||
material = SubResource("ShaderMaterial_dkeyh")
|
||||
layout_mode = 2
|
||||
theme = ExtResource("3_8d2ix")
|
||||
theme_type_variation = &"Arkanoid"
|
||||
@@ -91,7 +91,7 @@ size_flags_horizontal = 3
|
||||
theme = ExtResource("3_8d2ix")
|
||||
|
||||
[node name="Revenge" type="Label" parent="VBoxContainer/HBoxContainer2"]
|
||||
material = SubResource("ShaderMaterial_u0aoy")
|
||||
material = SubResource("ShaderMaterial_le8eo")
|
||||
layout_mode = 2
|
||||
theme = ExtResource("3_8d2ix")
|
||||
theme_type_variation = &"Arkanoid"
|
||||
|
||||
19
Music.gd
19
Music.gd
@@ -33,6 +33,7 @@ var JingleFileGameOver = preload("res://Sounds/GameOver.wav")
|
||||
var jingle_playing : bool = false
|
||||
var jingle_number : int = 0
|
||||
|
||||
var tween = null
|
||||
|
||||
func _ready() -> void:
|
||||
MusicPlayer = AudioStreamPlayer.new();
|
||||
@@ -43,7 +44,22 @@ func _ready() -> void:
|
||||
MusicPlayer.play()
|
||||
music = MUSIC_INTRO
|
||||
|
||||
func fade_up(time : int = 1) -> void:
|
||||
if MusicPlayer.volume_db < 0:
|
||||
if tween != null:
|
||||
tween.kill()
|
||||
tween = get_tree().create_tween()
|
||||
tween.tween_property(MusicPlayer, "volume_db", 0, time)
|
||||
|
||||
func fade_down(time : int = 1) -> void:
|
||||
if MusicPlayer.volume_db > -80:
|
||||
if tween != null:
|
||||
tween.kill()
|
||||
tween = get_tree().create_tween()
|
||||
tween.tween_property(MusicPlayer, "volume_db", -80, time)
|
||||
|
||||
func play_game() -> void:
|
||||
fade_up()
|
||||
if music == MUSIC_GAME:
|
||||
return
|
||||
if jingle_playing:
|
||||
@@ -54,6 +70,7 @@ func play_game() -> void:
|
||||
music = MUSIC_GAME
|
||||
|
||||
func play_intro() -> void:
|
||||
fade_up()
|
||||
if music == MUSIC_INTRO:
|
||||
return
|
||||
if jingle_playing:
|
||||
@@ -64,6 +81,7 @@ func play_intro() -> void:
|
||||
music = MUSIC_INTRO
|
||||
|
||||
func play_game_over() -> void:
|
||||
fade_up()
|
||||
if music == MUSIC_GAME_OVER:
|
||||
return
|
||||
if jingle_playing:
|
||||
@@ -81,6 +99,7 @@ func resume() -> void:
|
||||
MusicPlayer.play(pausepos)
|
||||
|
||||
func jingle(item : int) -> void:
|
||||
MusicPlayer.volume_db = 0
|
||||
jingle_number = item
|
||||
MusicPlayer.finished.connect(_jingle_done)
|
||||
pause()
|
||||
|
||||
@@ -18,9 +18,9 @@ point_count = 2
|
||||
[sub_resource type="Gradient" id="Gradient_ucorl"]
|
||||
colors = PackedColorArray(0, 0, 0, 0, 1, 1, 1, 1)
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ttnt2"]
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ax5sh"]
|
||||
shader = ExtResource("4_waenw")
|
||||
shader_parameter/rect_global_position = Vector2(0.012945, 0.048951)
|
||||
shader_parameter/rect_global_position = Vector2(8, 17.5)
|
||||
shader_parameter/rect_size = Vector2(608, 25)
|
||||
shader_parameter/ColourTexture = ExtResource("5_y0x1p")
|
||||
|
||||
@@ -76,7 +76,7 @@ autoplay = "default"
|
||||
centered = false
|
||||
|
||||
[node name="ArkaLabel" type="Label" parent="VBoxContainer"]
|
||||
material = SubResource("ShaderMaterial_ttnt2")
|
||||
material = SubResource("ShaderMaterial_ax5sh")
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 6
|
||||
theme = ExtResource("1_rv7oa")
|
||||
|
||||
Reference in New Issue
Block a user