Prechádzať zdrojové kódy

:sparkles: prepared leaderboard mechanic

Felix Bytow 10 mesiacov pred
rodič
commit
824ebe426d

+ 11 - 0
README.md

@@ -2,3 +2,14 @@
 
 Entry for the 2024 gamedev.tv game jam.
 This is a post-apocalyptic zombie survival rogue-like tower-defense game.
+
+## Structure
+
+ * `assets/`
+   * `audio` -- Music and SFX
+   * `autoload` -- Global/Static scenes with their scripts
+   * `fonts` -- Fonts
+   * `scripts` -- Reusable scripts
+   * `scenes` -- Scenes that may be instanced with their scripts
+   * `textures` -- Images
+ * `screens/` -- Top-level scenes with their scripts

BIN
assets/fonts/crimes.ttf


+ 33 - 0
assets/fonts/crimes.ttf.import

@@ -0,0 +1,33 @@
+[remap]
+
+importer="font_data_dynamic"
+type="FontFile"
+uid="uid://7xrvisb6ikax"
+path="res://.godot/imported/crimes.ttf-ad6324aabb5e3de07013ac74ef003cf8.fontdata"
+
+[deps]
+
+source_file="res://assets/fonts/crimes.ttf"
+dest_files=["res://.godot/imported/crimes.ttf-ad6324aabb5e3de07013ac74ef003cf8.fontdata"]
+
+[params]
+
+Rendering=null
+antialiasing=1
+generate_mipmaps=false
+multichannel_signed_distance_field=false
+msdf_pixel_range=8
+msdf_size=48
+allow_system_fallback=true
+force_autohinter=false
+hinting=1
+subpixel_positioning=1
+oversampling=0.0
+Fallbacks=null
+fallbacks=[]
+Compress=null
+compress=true
+preload=[]
+language_support={}
+script_support={}
+opentype_features={}

+ 6 - 0
assets/scripts/leaderboard.gd

@@ -0,0 +1,6 @@
+class_name Leaderboard
+
+const FILE_NAME = "user://leaderboard.json"
+
+static func exists():
+	return FileAccess.file_exists(FILE_NAME)

+ 5 - 0
project.godot

@@ -14,6 +14,11 @@ config/name="gdtv-gamejam-2024-last-stand"
 run/main_scene="res://screens/main_menu.tscn"
 config/features=PackedStringArray("4.2", "GL Compatibility")
 
+[display]
+
+window/size/viewport_width=1280
+window/size/viewport_height=720
+
 [rendering]
 
 renderer/rendering_method="gl_compatibility"

+ 5 - 3
screens/main_menu.gd

@@ -1,8 +1,10 @@
 extends Control
 
-func _on_button_pressed():
-	get_tree().quit()
-
+func _ready():
+	$Buttons/Leaderboard.disabled = not Leaderboard.exists()
 
 func _on_new_game_pressed():
 	pass # Replace with function body.
+
+func _on_quit_pressed():
+	get_tree().quit()

+ 26 - 6
screens/main_menu.tscn

@@ -1,6 +1,7 @@
-[gd_scene load_steps=2 format=3 uid="uid://bnug1ybm5mlyd"]
+[gd_scene load_steps=3 format=3 uid="uid://bnug1ybm5mlyd"]
 
 [ext_resource type="Script" path="res://screens/main_menu.gd" id="1_6qk7l"]
+[ext_resource type="FontFile" uid="uid://7xrvisb6ikax" path="res://assets/fonts/crimes.ttf" id="2_scvm2"]
 
 [node name="MainMenu" type="Control"]
 layout_mode = 3
@@ -16,11 +17,16 @@ layout_mode = 1
 anchors_preset = 5
 anchor_left = 0.5
 anchor_right = 0.5
-offset_left = -238.5
-offset_right = 238.5
-offset_bottom = 58.0
+offset_left = -399.0
+offset_top = 55.0
+offset_right = 399.0
+offset_bottom = 114.0
 grow_horizontal = 2
-theme_override_font_sizes/font_size = 42
+theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
+theme_override_constants/shadow_offset_x = 5
+theme_override_constants/shadow_offset_y = 5
+theme_override_fonts/font = ExtResource("2_scvm2")
+theme_override_font_sizes/font_size = 80
 text = "Last Stand of Humanity"
 
 [node name="Buttons" type="VBoxContainer" parent="."]
@@ -42,9 +48,23 @@ layout_mode = 2
 theme_override_font_sizes/font_size = 23
 text = "NEW GAME"
 
+[node name="Leaderboard" type="Button" parent="Buttons"]
+layout_mode = 2
+disabled = true
+text = "LEADERBOARD"
+
+[node name="Settings" type="Button" parent="Buttons"]
+layout_mode = 2
+disabled = true
+text = "SETTINGS"
+
+[node name="Credits" type="Button" parent="Buttons"]
+layout_mode = 2
+text = "CREDITS"
+
 [node name="Quit" type="Button" parent="Buttons"]
 layout_mode = 2
 text = "QUIT"
 
 [connection signal="pressed" from="Buttons/NewGame" to="." method="_on_new_game_pressed"]
-[connection signal="pressed" from="Buttons/Quit" to="." method="_on_button_pressed"]
+[connection signal="pressed" from="Buttons/Quit" to="." method="_on_quit_pressed"]