Skip to content

Commit ad2f0a3

Browse files
committed
feat: add credits screen
Included CREDITS.md into the actual game, so it should be able to be packaged and distributed while complying with licenses. Also seeded the RNG and added an icon.
1 parent d6fe9d8 commit ad2f0a3

File tree

7 files changed

+96
-7
lines changed

7 files changed

+96
-7
lines changed

assets/icon.png

8.77 KB
Loading

assets/icon.png.import

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/icon.png-b6a7fb2db36edd3d95dc42f1dc8c1c5d.stex"
6+
metadata={
7+
"vram_texture": false
8+
}
9+
10+
[deps]
11+
12+
source_file="res://assets/icon.png"
13+
dest_files=[ "res://.import/icon.png-b6a7fb2db36edd3d95dc42f1dc8c1c5d.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

scenes/credits.tscn

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[gd_scene load_steps=3 format=2]
2+
3+
[ext_resource path="res://assets/theme.theme" type="Theme" id=1]
4+
[ext_resource path="res://scripts/credits.gd" type="Script" id=2]
5+
6+
[node name="MarginContainer" type="MarginContainer"]
7+
anchor_right = 1.0
8+
anchor_bottom = 1.0
9+
theme = ExtResource( 1 )
10+
custom_constants/margin_right = 40
11+
custom_constants/margin_top = 30
12+
custom_constants/margin_left = 40
13+
custom_constants/margin_bottom = 30
14+
__meta__ = {
15+
"_edit_use_anchors_": false
16+
}
17+
18+
[node name="Credits" type="Label" parent="."]
19+
margin_left = 40.0
20+
margin_top = 30.0
21+
margin_right = 1880.0
22+
margin_bottom = 1050.0
23+
size_flags_vertical = 3
24+
autowrap = true
25+
script = ExtResource( 2 )

scenes/menu.tscn

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,30 @@ margin_top = 973.0
4646
margin_right = 1839.0
4747
margin_bottom = 973.0
4848

49-
[node name="StartButton" type="Button" parent="MainMenu"]
50-
margin_left = 872.0
49+
[node name="Buttons" type="HBoxContainer" parent="MainMenu"]
50+
margin_left = 555.0
5151
margin_top = 981.0
52-
margin_right = 967.0
52+
margin_right = 1283.0
5353
margin_bottom = 1019.0
5454
size_flags_horizontal = 4
55+
custom_constants/separation = 500
56+
57+
[node name="Start" type="Button" parent="MainMenu/Buttons"]
58+
margin_right = 95.0
59+
margin_bottom = 38.0
60+
size_flags_horizontal = 4
5561
text = "start"
5662
flat = true
5763

64+
[node name="Credits" type="Button" parent="MainMenu/Buttons"]
65+
margin_left = 595.0
66+
margin_right = 728.0
67+
margin_bottom = 38.0
68+
text = "credits"
69+
5870
[node name="Timer" type="Timer" parent="."]
5971
wait_time = 0.25
6072
autostart = true
61-
[connection signal="pressed" from="MainMenu/StartButton" to="MainMenu" method="_on_StartButton_pressed"]
73+
[connection signal="pressed" from="MainMenu/Buttons/Start" to="MainMenu" method="_on_Start_pressed"]
74+
[connection signal="pressed" from="MainMenu/Buttons/Credits" to="MainMenu" method="_on_Credits_pressed"]
6275
[connection signal="timeout" from="Timer" to="MainMenu" method="_on_Timer_timeout"]

scripts/credits.gd

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
extends Label
2+
3+
func _ready():
4+
var file = File.new()
5+
file.open("res://CREDITS.md", File.READ)
6+
text = file.get_as_text()
7+
file.close()
8+
9+
func _process(delta):
10+
rect_position.y -= 1
11+
12+
func _input(event):
13+
scene.change_scene("res://scenes/menu.tscn")

scripts/levels.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var level
66
func _ready():
77
# Load level data
88
var descriptions = File.new()
9-
descriptions.open("res://assets/levels.json", descriptions.READ)
9+
descriptions.open("res://assets/levels.json", File.READ)
1010
levels = parse_json(descriptions.get_as_text())
1111
# Dynamically add buttons
1212
for level in levels:

scripts/menu.gd

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ extends VBoxContainer
33
var level = BogoSort.new(ArrayModel.new(10))
44

55
func _ready():
6-
$StartButton.grab_focus()
6+
$Buttons/Start.grab_focus()
77
$Display.add_child(ArrayView.new(level))
8+
randomize()
89

9-
func _on_StartButton_pressed():
10+
func _on_Start_pressed():
1011
scene.change_scene("res://scenes/levels.tscn")
1112

13+
func _on_Credits_pressed():
14+
scene.change_scene("res://scenes/credits.tscn")
15+
1216
func _on_Timer_timeout():
1317
level.next()

0 commit comments

Comments
 (0)