From 6539056cfb42498cb45e3748646ef99921792005 Mon Sep 17 00:00:00 2001 From: zoe Date: Fri, 1 Oct 2021 17:28:14 +0200 Subject: [PATCH] some fixes --- Menu/Buttons/AudioSliders/VolumeSlider.gd | 3 + Menu/Buttons/AudioSliders/VolumeSlider.tscn | 2 + Menu/LevelList.tscn | 111 ++++++++++++++++++++ Menu/MainMenu.tscn | 97 ++--------------- Stages/World.gd | 5 +- Stats/Saves.gd | 9 +- default_bus_layout.tres | 4 +- export_presets.cfg | 2 +- 8 files changed, 135 insertions(+), 98 deletions(-) create mode 100644 Menu/LevelList.tscn diff --git a/Menu/Buttons/AudioSliders/VolumeSlider.gd b/Menu/Buttons/AudioSliders/VolumeSlider.gd index 575d34d..e739ff8 100644 --- a/Menu/Buttons/AudioSliders/VolumeSlider.gd +++ b/Menu/Buttons/AudioSliders/VolumeSlider.gd @@ -7,3 +7,6 @@ func _ready(): func _on_MusicVolumeSlider_value_changed(value): AudioServer.set_bus_volume_db(AudioServer.get_bus_index(bus_channel), linear2db(value)) + +func save_volume(): + Saves.save_game() diff --git a/Menu/Buttons/AudioSliders/VolumeSlider.tscn b/Menu/Buttons/AudioSliders/VolumeSlider.tscn index fd514e4..694587e 100644 --- a/Menu/Buttons/AudioSliders/VolumeSlider.tscn +++ b/Menu/Buttons/AudioSliders/VolumeSlider.tscn @@ -16,4 +16,6 @@ __meta__ = { "_edit_use_anchors_": false } +[connection signal="focus_exited" from="." to="." method="save_volume"] +[connection signal="mouse_exited" from="." to="." method="save_volume"] [connection signal="value_changed" from="." to="." method="_on_MusicVolumeSlider_value_changed"] diff --git a/Menu/LevelList.tscn b/Menu/LevelList.tscn new file mode 100644 index 0000000..5853c64 --- /dev/null +++ b/Menu/LevelList.tscn @@ -0,0 +1,111 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://Menu/Theme.tres" type="Theme" id=1] +[ext_resource path="res://icon.png" type="Texture" id=2] +[ext_resource path="res://Menu/Buttons/SceneSelectButton.tscn" type="PackedScene" id=5] + +[node name="LevelList" type="ScrollContainer"] +margin_left = 176.0 +margin_right = 368.0 +margin_bottom = 165.0 +theme = ExtResource( 1 ) +follow_focus = true +scroll_horizontal_enabled = false +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="LevelListHBox" type="VBoxContainer" parent="."] +margin_left = 2.0 +margin_top = 2.0 +margin_right = 170.0 +margin_bottom = 438.0 + +[node name="SceneSelectButton" parent="LevelListHBox" instance=ExtResource( 5 )] +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_right = 168.0 +margin_bottom = 40.0 +icon = ExtResource( 2 ) +scene = "res://Stages/EmptyStage.tscn" + +[node name="SceneSelectButton2" parent="LevelListHBox" instance=ExtResource( 5 )] +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_top = 44.0 +margin_right = 168.0 +margin_bottom = 84.0 +icon = ExtResource( 2 ) +scene = "res://Stages/EmptyStage.tscn" + +[node name="SceneSelectButton3" parent="LevelListHBox" instance=ExtResource( 5 )] +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_top = 88.0 +margin_right = 168.0 +margin_bottom = 128.0 +icon = ExtResource( 2 ) +scene = "res://Stages/EmptyStage.tscn" + +[node name="SceneSelectButton4" parent="LevelListHBox" instance=ExtResource( 5 )] +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_top = 132.0 +margin_right = 168.0 +margin_bottom = 172.0 +icon = ExtResource( 2 ) +scene = "res://Stages/EmptyStage.tscn" + +[node name="SceneSelectButton5" parent="LevelListHBox" instance=ExtResource( 5 )] +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_top = 176.0 +margin_right = 168.0 +margin_bottom = 216.0 +icon = ExtResource( 2 ) +scene = "res://Stages/EmptyStage.tscn" + +[node name="SceneSelectButton6" parent="LevelListHBox" instance=ExtResource( 5 )] +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_top = 220.0 +margin_right = 168.0 +margin_bottom = 260.0 +icon = ExtResource( 2 ) +scene = "res://Stages/EmptyStage.tscn" + +[node name="SceneSelectButton7" parent="LevelListHBox" instance=ExtResource( 5 )] +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_top = 264.0 +margin_right = 168.0 +margin_bottom = 304.0 +icon = ExtResource( 2 ) +scene = "res://Stages/EmptyStage.tscn" + +[node name="SceneSelectButton8" parent="LevelListHBox" instance=ExtResource( 5 )] +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_top = 308.0 +margin_right = 168.0 +margin_bottom = 348.0 +icon = ExtResource( 2 ) +scene = "res://Stages/EmptyStage.tscn" + +[node name="SceneSelectButton9" parent="LevelListHBox" instance=ExtResource( 5 )] +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_top = 352.0 +margin_right = 168.0 +margin_bottom = 392.0 +icon = ExtResource( 2 ) +scene = "res://Stages/EmptyStage.tscn" + +[node name="SceneSelectButton10" parent="LevelListHBox" instance=ExtResource( 5 )] +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_top = 396.0 +margin_right = 168.0 +margin_bottom = 436.0 +icon = ExtResource( 2 ) +scene = "res://Stages/EmptyStage.tscn" diff --git a/Menu/MainMenu.tscn b/Menu/MainMenu.tscn index cacd211..5ae88f8 100644 --- a/Menu/MainMenu.tscn +++ b/Menu/MainMenu.tscn @@ -1,13 +1,11 @@ -[gd_scene load_steps=14 format=2] +[gd_scene load_steps=12 format=2] [ext_resource path="res://Menu/Theme.tres" type="Theme" id=1] -[ext_resource path="res://Menu/Buttons/SceneSelectButton.tscn" type="PackedScene" id=2] +[ext_resource path="res://Menu/LevelList.tscn" type="PackedScene" id=2] [ext_resource path="res://Effects/FadeIn.tscn" type="PackedScene" id=3] [ext_resource path="res://Cannon/Cannon.tscn" type="PackedScene" id=4] [ext_resource path="res://Menu/Buttons/Fullscreen/FullscreenButton.tscn" type="PackedScene" id=5] -[ext_resource path="res://icon.png" type="Texture" id=6] [ext_resource path="res://Menu/LevelInfo.tscn" type="PackedScene" id=7] -[ext_resource path="res://Pegs/Pink/Pink.png" type="Texture" id=8] [ext_resource path="res://Menu/Buttons/AudioSliders/VolumeSlider.tscn" type="PackedScene" id=9] [ext_resource path="res://Menu/Buttons/AudioSliders/MusicVolume1.png" type="Texture" id=10] [ext_resource path="res://Menu/Buttons/AudioSliders/MusicVolume2.png" type="Texture" id=11] @@ -103,96 +101,13 @@ __meta__ = { } [node name="LevelInfo" parent="Control/TabContainer/Levels/HBoxContainer" instance=ExtResource( 7 )] -margin_left = 157.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 55.0 margin_right = 172.0 - -[node name="LevelList" type="ScrollContainer" parent="Control/TabContainer/Levels/HBoxContainer"] -margin_left = 176.0 -margin_right = 368.0 margin_bottom = 165.0 -theme = ExtResource( 1 ) -follow_focus = true -scroll_horizontal_enabled = false -[node name="LevelListHBox" type="VBoxContainer" parent="Control/TabContainer/Levels/HBoxContainer/LevelList"] -margin_left = 2.0 -margin_top = 2.0 -margin_right = 170.0 -margin_bottom = 335.0 - -[node name="LevelSelectButton" parent="Control/TabContainer/Levels/HBoxContainer/LevelList/LevelListHBox" instance=ExtResource( 2 )] -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_right = 168.0 -margin_bottom = 25.0 -icon = ExtResource( 8 ) -scene = "res://Stages/EmptyStage.tscn" - -[node name="LevelSelectButton3" parent="Control/TabContainer/Levels/HBoxContainer/LevelList/LevelListHBox" instance=ExtResource( 2 )] -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_top = 29.0 -margin_right = 168.0 -margin_bottom = 69.0 -icon = ExtResource( 6 ) -scene = "res://Stages/EmptyStage.tscn" -unlock_points_required = 10 - -[node name="LevelSelectButton4" parent="Control/TabContainer/Levels/HBoxContainer/LevelList/LevelListHBox" instance=ExtResource( 2 )] -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_top = 73.0 -margin_right = 168.0 -margin_bottom = 113.0 -text = "> piss" -icon = ExtResource( 6 ) -scene = "res://Stages/EmptyStage.tscn" -unlock_points_required = 20 - -[node name="LevelSelectButton5" parent="Control/TabContainer/Levels/HBoxContainer/LevelList/LevelListHBox" instance=ExtResource( 2 )] -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_top = 117.0 -margin_right = 168.0 -margin_bottom = 157.0 -icon = ExtResource( 6 ) -scene = "res://Stages/EmptyStage.tscn" - -[node name="LevelSelectButton6" parent="Control/TabContainer/Levels/HBoxContainer/LevelList/LevelListHBox" instance=ExtResource( 2 )] -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_top = 161.0 -margin_right = 168.0 -margin_bottom = 201.0 -icon = ExtResource( 6 ) -scene = "res://Stages/EmptyStage.tscn" - -[node name="LevelSelectButton7" parent="Control/TabContainer/Levels/HBoxContainer/LevelList/LevelListHBox" instance=ExtResource( 2 )] -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_top = 205.0 -margin_right = 168.0 -margin_bottom = 245.0 -icon = ExtResource( 6 ) -scene = "res://Stages/EmptyStage.tscn" - -[node name="LevelSelectButton8" parent="Control/TabContainer/Levels/HBoxContainer/LevelList/LevelListHBox" instance=ExtResource( 2 )] -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_top = 249.0 -margin_right = 168.0 -margin_bottom = 289.0 -icon = ExtResource( 6 ) -scene = "res://Stages/EmptyStage.tscn" - -[node name="LevelSelectButton9" parent="Control/TabContainer/Levels/HBoxContainer/LevelList/LevelListHBox" instance=ExtResource( 2 )] -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_top = 293.0 -margin_right = 168.0 -margin_bottom = 333.0 -icon = ExtResource( 6 ) -scene = "res://Stages/EmptyStage.tscn" +[node name="LevelList" parent="Control/TabContainer/Levels/HBoxContainer" instance=ExtResource( 2 )] [node name="Transition" parent="." instance=ExtResource( 3 )] diff --git a/Stages/World.gd b/Stages/World.gd index ebee759..d573ec3 100644 --- a/Stages/World.gd +++ b/Stages/World.gd @@ -6,9 +6,8 @@ export var already_beaten = false func _ready(): load_level() - $Killzone.connect("level_just_won", self, "save_level") + var _killzone_connec = $Killzone.connect("level_just_won", self, "save_level") GameStats.multiplier = 1 - print(high_score) func _physics_process(_delta): fast_forward() @@ -43,7 +42,7 @@ func save_level(): if GameStats.score > high_score: - print("New High score!") + # new highscore!!! high_score = GameStats.score var data = { diff --git a/Stats/Saves.gd b/Stats/Saves.gd index 7757ece..095162b 100644 --- a/Stats/Saves.gd +++ b/Stats/Saves.gd @@ -7,7 +7,9 @@ func _ready(): func save_game(): var data = { - "unlock_points" : GameStats.unlock_points + "unlock_points" : GameStats.unlock_points, + "music_volume" : AudioServer.get_bus_volume_db(AudioServer.get_bus_index("Music")), + "sfx_volume" : AudioServer.get_bus_volume_db(AudioServer.get_bus_index("SFX")) } print(data) @@ -26,6 +28,11 @@ func load_game(): var data = file.get_var() file.close() load_unlock_points(data) + load_volume(data) func load_unlock_points(data): GameStats.unlock_points = data.unlock_points + +func load_volume(data): + AudioServer.set_bus_volume_db(AudioServer.get_bus_index("SFX"), data.sfx_volume) + AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Music"), data.music_volume) diff --git a/default_bus_layout.tres b/default_bus_layout.tres index ee0da23..a23cbab 100644 --- a/default_bus_layout.tres +++ b/default_bus_layout.tres @@ -5,11 +5,11 @@ bus/1/name = "SFX" bus/1/solo = false bus/1/mute = false bus/1/bypass_fx = false -bus/1/volume_db = 0.207247 +bus/1/volume_db = -5.04224 bus/1/send = "Master" bus/2/name = "Music" bus/2/solo = false bus/2/mute = false bus/2/bypass_fx = false -bus/2/volume_db = -80.0 +bus/2/volume_db = -5.04224 bus/2/send = "Master" diff --git a/export_presets.cfg b/export_presets.cfg index bc4baee..8e4d8e2 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -32,7 +32,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="" +export_path="../pegchampBuild/pegchamp.exe" script_export_mode=1 script_encryption_key=""