summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrom <romangraef@gmail.com>2021-04-26 16:15:42 +0200
committerrom <romangraef@gmail.com>2021-04-26 16:15:42 +0200
commit670c575ee920b730578f2a3eb78c13c08771fe19 (patch)
tree70bd73f96d5bd63358808cafd3d9869c21826db7
parent5bdee50847bb9d0ee4f49c9988043734490fa4cb (diff)
downloadldjam48-670c575ee920b730578f2a3eb78c13c08771fe19.tar.gz
ldjam48-670c575ee920b730578f2a3eb78c13c08771fe19.tar.bz2
ldjam48-670c575ee920b730578f2a3eb78c13c08771fe19.zip
settings
-rw-r--r--scenes/menu.gd23
-rw-r--r--scenes/menu.tscn68
2 files changed, 88 insertions, 3 deletions
diff --git a/scenes/menu.gd b/scenes/menu.gd
index e4f254e..f0be2dd 100644
--- a/scenes/menu.gd
+++ b/scenes/menu.gd
@@ -2,7 +2,7 @@ extends Node2D
func _ready():
- pass
+ _difficulty_text()
func _on_Exit_on_click():
@@ -15,4 +15,23 @@ func _on_Strart_on_click():
func _on_Outgoing_animation_finished(anim_name):
- get_tree().change_scene("res://scenes/introduction/come home.tscn")
+ if anim_name == "tointro":
+ get_tree().change_scene("res://scenes/introduction/come home.tscn")
+
+
+func _on_Back_on_click():
+ $Outgoing.play_backwards("tosettings")
+
+func _difficulty_text():
+ if Settings.difficulty == Settings.Difficulty.HARD:
+ $Content/CustomLabel.text = "Hard"
+ else:
+ $Content/CustomLabel.text = "Easy"
+
+func _on_HardMode_on_click():
+ Settings.difficulty = 1 - Settings.difficulty
+ _difficulty_text()
+ Settings.save()
+
+func _on_SettingsButton_on_click():
+ $Outgoing.play("tosettings")
diff --git a/scenes/menu.tscn b/scenes/menu.tscn
index 1d038c8..3828ad6 100644
--- a/scenes/menu.tscn
+++ b/scenes/menu.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=12 format=2]
+[gd_scene load_steps=13 format=2]
[ext_resource path="res://components/Logo.tscn" type="PackedScene" id=1]
[ext_resource path="res://components/button.tscn" type="PackedScene" id=2]
@@ -49,6 +49,18 @@ tracks/2/keys = {
"points": PoolRealArray( 1508.94, -0.25, 0, 0.25, 0, 850, -1.39, 12.618, 0.25, 0 ),
"times": PoolRealArray( 0.8, 2 )
}
+tracks/3/type = "value"
+tracks/3/path = NodePath("Content/SettingsButton:position")
+tracks/3/interp = 1
+tracks/3/loop_wrap = true
+tracks/3/imported = false
+tracks/3/enabled = true
+tracks/3/keys = {
+"times": PoolRealArray( 0, 0.8, 2 ),
+"transitions": PoolRealArray( 1, 1, 1 ),
+"update": 0,
+"values": [ Vector2( 640, 839.866 ), Vector2( 640, 839.866 ), Vector2( 640, 630 ) ]
+}
[sub_resource type="Animation" id=3]
resource_name = "tointro"
@@ -84,6 +96,22 @@ tracks/2/keys = {
"times": PoolRealArray( 0, 1.7 )
}
+[sub_resource type="Animation" id=4]
+resource_name = "tosettings"
+length = 0.5
+tracks/0/type = "value"
+tracks/0/path = NodePath("Content:position")
+tracks/0/interp = 2
+tracks/0/loop_wrap = true
+tracks/0/imported = false
+tracks/0/enabled = true
+tracks/0/keys = {
+"times": PoolRealArray( 0, 0.5 ),
+"transitions": PoolRealArray( 1, 1 ),
+"update": 0,
+"values": [ Vector2( 0, 0 ), Vector2( 0, -725.715 ) ]
+}
+
[node name="Node2D" type="Node2D"]
script = ExtResource( 5 )
@@ -94,6 +122,36 @@ texture = ExtResource( 3 )
[node name="Content" type="Node2D" parent="."]
+[node name="Back" parent="Content" instance=ExtResource( 2 )]
+position = Vector2( 400.655, 1310.32 )
+text = "Back"
+fixed_width = 150
+
+[node name="DifficultyLabel" type="Label" parent="Content"]
+margin_left = 95.3517
+margin_top = 823.866
+margin_right = 135.352
+margin_bottom = 855.866
+text = "Difficulty: "
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="HardMode" parent="Content" instance=ExtResource( 2 )]
+position = Vector2( 400.655, 839.866 )
+text = ""
+fixed_width = 150
+
+[node name="CustomLabel" type="Label" parent="Content"]
+margin_left = 328.655
+margin_top = 823.866
+margin_right = 473.655
+margin_bottom = 855.866
+text = "Hard Mode"
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
[node name="Badge" type="Node2D" parent="Content"]
position = Vector2( 630.621, -217.796 )
@@ -125,14 +183,22 @@ position = Vector2( -150, 500 )
text = "Start"
fixed_width = 150
+[node name="SettingsButton" parent="Content" instance=ExtResource( 2 )]
+position = Vector2( 640, 630 )
+text = "Settings"
+
[node name="Transitions" type="AnimationPlayer" parent="."]
autoplay = "startgame"
anims/startgame = SubResource( 2 )
[node name="Outgoing" type="AnimationPlayer" parent="."]
anims/tointro = SubResource( 3 )
+anims/tosettings = SubResource( 4 )
+[connection signal="on_click" from="Content/Back" to="." method="_on_Back_on_click"]
+[connection signal="on_click" from="Content/HardMode" to="." method="_on_HardMode_on_click"]
[connection signal="on_click" from="Content/Exit" to="." method="_on_Exit_on_click"]
[connection signal="on_click" from="Content/Strart" to="." method="_on_Strart_on_click"]
+[connection signal="on_click" from="Content/SettingsButton" to="." method="_on_SettingsButton_on_click"]
[connection signal="animation_finished" from="Transitions" to="." method="_on_Transitions_animation_finished"]
[connection signal="animation_finished" from="Outgoing" to="." method="_on_Outgoing_animation_finished"]