Skip to content

Commit a73f9d3

Browse files
committed
part 12 - save settings, About screen
1 parent b7eb92d commit a73f9d3

14 files changed

Lines changed: 248 additions & 34 deletions

LICENSE

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,31 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
22+
23+
----
24+
25+
Godot Engine
26+
27+
Copyright © 2007-2019 Juan Linietsky, Ariel Manzur.
28+
Copyright © 2014-2019 Godot Engine contributors.
29+
30+
Permission is hereby granted, free of charge, to any person obtaining a copy
31+
of this software and associated documentation files (the “Software”), to deal
32+
in the Software without restriction, including without limitation the rights
33+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
34+
copies of the Software, and to permit persons to whom the Software is
35+
furnished to do so, subject to the following conditions:
36+
37+
The above copyright notice and this permission notice shall be included in all
38+
copies or substantial portions of the Software.
39+
40+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
41+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
42+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
43+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
44+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
45+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
46+
SOFTWARE.
47+
48+
Portions of this software are copyright © 2019 The FreeType Project
49+
(www.freetype.org). All rights reserved.

UI/AboutScreen.tscn

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
[gd_scene load_steps=5 format=2]
2+
3+
[ext_resource path="res://UI/BaseScreen.tscn" type="PackedScene" id=1]
4+
[ext_resource path="res://assets/fonts/Xolonium-Regular.ttf" type="DynamicFontData" id=2]
5+
[ext_resource path="res://assets/images/buttons/return.png" type="Texture" id=3]
6+
7+
[sub_resource type="DynamicFont" id=1]
8+
size = 20
9+
font_data = ExtResource( 2 )
10+
11+
[node name="AboutScreen" index="0" instance=ExtResource( 1 )]
12+
13+
[node name="Label" parent="MarginContainer/VBoxContainer" index="0"]
14+
text = ""
15+
16+
[node name="VBoxContainer2" type="VBoxContainer" parent="MarginContainer" index="1"]
17+
margin_left = 20.0
18+
margin_top = 20.0
19+
margin_right = 460.0
20+
margin_bottom = 834.0
21+
22+
[node name="TextEdit" type="RichTextLabel" parent="MarginContainer/VBoxContainer2" index="0"]
23+
margin_right = 440.0
24+
margin_bottom = 710.0
25+
size_flags_horizontal = 3
26+
size_flags_vertical = 3
27+
custom_fonts/normal_font = SubResource( 1 )
28+
bbcode_enabled = true
29+
bbcode_text = "[center][u]Circle Jump[/u]
30+
31+
[img]res://assets/images/godot_logo.png[/img][/center]
32+
33+
Circle Jump is an open source tutorial game made with the Godot Game Engine. You can find the tutorial and the game's source code here:
34+
35+
[url=https://github.com/kidscancode/circle_jump]Circle Jump Source[/url]
36+
37+
Copyright © 2019 KidsCanCode
38+
39+
[url=https://github.com/kidscancode/circle_jump/blob/master/LICENSE]License Information[/url]"
40+
text = "Circle Jump
41+
42+
43+
44+
Circle Jump is an open source tutorial game made with the Godot Game Engine. You can find the tutorial and the game's source code here:
45+
46+
Circle Jump Source
47+
48+
Copyright © 2019 KidsCanCode
49+
50+
License Information"
51+
52+
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/VBoxContainer2" index="1"]
53+
margin_top = 714.0
54+
margin_right = 440.0
55+
margin_bottom = 814.0
56+
57+
[node name="Home" type="TextureButton" parent="MarginContainer/VBoxContainer2/CenterContainer" index="0" groups=[
58+
"buttons",
59+
]]
60+
margin_left = 170.0
61+
margin_right = 270.0
62+
margin_bottom = 100.0
63+
texture_normal = ExtResource( 3 )
64+
[connection signal="meta_clicked" from="MarginContainer/VBoxContainer2/TextEdit" to="." method="_on_TextEdit_meta_clicked"]

UI/BaseScreen.gd

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,7 @@ func disappear():
1212
get_tree().call_group("buttons", "set_disabled", true)
1313
tween.interpolate_property(self, "offset:x", 0, 500,
1414
0.5, Tween.TRANS_BACK, Tween.EASE_IN_OUT)
15-
tween.start()
15+
tween.start()
16+
17+
func _on_TextEdit_meta_clicked(meta):
18+
OS.shell_open(meta)

UI/Screens.gd

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,23 @@ func register_buttons():
1717
var buttons = get_tree().get_nodes_in_group("buttons")
1818
for button in buttons:
1919
button.connect("pressed", self, "_on_button_pressed", [button])
20+
match button.name:
21+
"Ads":
22+
if settings.enable_ads:
23+
button.text = "Disable Ads"
24+
else:
25+
button.text = "Enable Ads"
26+
"Sound":
27+
button.texture_normal = sound_buttons[settings.enable_sound]
28+
"Music":
29+
button.texture_normal = music_buttons[settings.enable_music]
2030

2131
func _on_button_pressed(button):
2232
if settings.enable_sound:
2333
$Click.play()
2434
match button.name:
35+
"About":
36+
change_screen($AboutScreen)
2537
"Ads":
2638
settings.enable_ads = !settings.enable_ads
2739
if settings.enable_ads:
@@ -39,9 +51,11 @@ func _on_button_pressed(button):
3951
"Sound":
4052
settings.enable_sound = !settings.enable_sound
4153
button.texture_normal = sound_buttons[settings.enable_sound]
54+
settings.save_settings()
4255
"Music":
4356
settings.enable_music = !settings.enable_music
4457
button.texture_normal = music_buttons[settings.enable_music]
58+
settings.save_settings()
4559

4660
func change_screen(new_screen):
4761
if current_screen:

UI/Screens.tscn

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
[gd_scene load_steps=6 format=2]
1+
[gd_scene load_steps=7 format=2]
22

33
[ext_resource path="res://UI/Screens.gd" type="Script" id=1]
44
[ext_resource path="res://UI/TitleScreen.tscn" type="PackedScene" id=2]
55
[ext_resource path="res://UI/SettingsScreen.tscn" type="PackedScene" id=3]
66
[ext_resource path="res://UI/GameOverScreen.tscn" type="PackedScene" id=4]
7-
[ext_resource path="res://assets/audio/menu_click.wav" type="AudioStream" id=5]
7+
[ext_resource path="res://UI/AboutScreen.tscn" type="PackedScene" id=5]
8+
[ext_resource path="res://assets/audio/menu_click.wav" type="AudioStream" id=6]
89

910
[node name="Screens" type="Node"]
1011
script = ExtResource( 1 )
@@ -15,5 +16,7 @@ script = ExtResource( 1 )
1516

1617
[node name="GameOverScreen" parent="." instance=ExtResource( 4 )]
1718

19+
[node name="AboutScreen" parent="." instance=ExtResource( 5 )]
20+
1821
[node name="Click" type="AudioStreamPlayer" parent="."]
19-
stream = ExtResource( 5 )
22+
stream = ExtResource( 6 )

UI/SettingsScreen.tscn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
size = 48
2121
font_data = ExtResource( 4 )
2222

23-
[node name="SettingsScreen" index="0" instance=ExtResource( 1 )]
23+
[node name="SettingsScreen" instance=ExtResource( 1 )]
2424

2525
[node name="Label" parent="MarginContainer/VBoxContainer" index="0"]
2626
text = "Settings"

UI/TitleScreen.tscn

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
1-
[gd_scene load_steps=4 format=2]
1+
[gd_scene load_steps=11 format=2]
22

33
[ext_resource path="res://UI/BaseScreen.tscn" type="PackedScene" id=1]
44
[ext_resource path="res://assets/images/buttons/right.png" type="Texture" id=2]
55
[ext_resource path="res://assets/images/buttons/gear.png" type="Texture" id=3]
6+
[ext_resource path="res://assets/fonts/Xolonium-Regular.ttf" type="DynamicFontData" id=4]
7+
8+
[sub_resource type="StyleBoxEmpty" id=1]
9+
10+
[sub_resource type="StyleBoxEmpty" id=2]
11+
12+
[sub_resource type="StyleBoxEmpty" id=3]
13+
14+
[sub_resource type="StyleBoxEmpty" id=4]
15+
16+
[sub_resource type="StyleBoxEmpty" id=5]
17+
18+
[sub_resource type="DynamicFont" id=6]
19+
size = 32
20+
font_data = ExtResource( 4 )
621

722
[node name="TitleScreen" instance=ExtResource( 1 )]
823

@@ -28,6 +43,24 @@ margin_right = 357.0
2843
margin_bottom = 100.0
2944
texture_normal = ExtResource( 3 )
3045

31-
[node name="Buttons2" parent="MarginContainer/VBoxContainer" index="2"]
46+
[node name="Buttons3" parent="MarginContainer/VBoxContainer" index="2"]
3247
margin_top = 478.0
3348
margin_bottom = 478.0
49+
50+
[node name="Buttons2" parent="MarginContainer/VBoxContainer" index="3"]
51+
margin_top = 628.0
52+
margin_bottom = 667.0
53+
54+
[node name="About" type="Button" parent="MarginContainer/VBoxContainer/Buttons2" index="0" groups=[
55+
"buttons",
56+
]]
57+
margin_left = 169.0
58+
margin_right = 271.0
59+
margin_bottom = 39.0
60+
custom_styles/hover = SubResource( 1 )
61+
custom_styles/pressed = SubResource( 2 )
62+
custom_styles/focus = SubResource( 3 )
63+
custom_styles/disabled = SubResource( 4 )
64+
custom_styles/normal = SubResource( 5 )
65+
custom_fonts/font = SubResource( 6 )
66+
text = "About"

assets/images/godot_logo.png

6.89 KB
Loading
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="StreamTexture"
5+
path="res://.import/godot_logo.png-ccbc8193ecd82c5225f2d298d6dc5ac9.stex"
6+
metadata={
7+
"vram_texture": false
8+
}
9+
10+
[deps]
11+
12+
source_file="res://assets/images/godot_logo.png"
13+
dest_files=[ "res://.import/godot_logo.png-ccbc8193ecd82c5225f2d298d6dc5ac9.stex" ]
14+
15+
[params]
16+
17+
compress/mode=0
18+
compress/lossy_quality=0.7
19+
compress/hdr_mode=0
20+
compress/bptc_ldr=0
21+
compress/normal_map=0
22+
flags/repeat=0
23+
flags/filter=true
24+
flags/mipmaps=false
25+
flags/anisotropic=false
26+
flags/srgb=2
27+
process/fix_alpha_border=true
28+
process/premult_alpha=false
29+
process/HDR_as_SRGB=false
30+
process/invert_color=false
31+
stream=false
32+
size_limit=0
33+
detect_3d=true
34+
svg/scale=1.0

assets/images/splash_screen.png

17 KB
Loading

0 commit comments

Comments
 (0)