Przeglądaj źródła

:sparkles::recycle: some code improvements and replaced logo images

Felix Bytow 10 miesięcy temu
rodzic
commit
3c09271ff9

+ 17 - 0
assets/autoload/config.gd

@@ -0,0 +1,17 @@
+extends Node
+
+const FILE_NAME = "user://config.ini"
+
+@onready var content: ConfigFile = ConfigFile.new()
+
+var show_tutorial: bool:
+	set(new_value):
+		content.set_value("general", "show_tutorial", new_value)
+	get:
+		return content.get_value("general", "show_tutorial", true)
+
+func _ready() -> void:
+	content.load("user://config.ini")
+	
+func save() -> void:
+	content.save(FILE_NAME)

+ 0 - 6
assets/autoload/global_input.tscn

@@ -1,6 +0,0 @@
-[gd_scene load_steps=2 format=3 uid="uid://dru2nvlrc4jf"]
-
-[ext_resource type="Script" path="res://assets/autoload/global_input.gd" id="1_milwh"]
-
-[node name="GlobalInput" type="Node"]
-script = ExtResource("1_milwh")

BIN
assets/fonts/Potra.ttf


+ 4 - 4
assets/fonts/crimes.ttf.import → assets/fonts/Potra.ttf.import

@@ -2,13 +2,13 @@
 
 importer="font_data_dynamic"
 type="FontFile"
-uid="uid://7xrvisb6ikax"
-path="res://.godot/imported/crimes.ttf-ad6324aabb5e3de07013ac74ef003cf8.fontdata"
+uid="uid://cqtognhaksl7j"
+path="res://.godot/imported/Potra.ttf-da7a7c5dcb1d607d4a07162884b54647.fontdata"
 
 [deps]
 
-source_file="res://assets/fonts/crimes.ttf"
-dest_files=["res://.godot/imported/crimes.ttf-ad6324aabb5e3de07013ac74ef003cf8.fontdata"]
+source_file="res://assets/fonts/Potra.ttf"
+dest_files=["res://.godot/imported/Potra.ttf-da7a7c5dcb1d607d4a07162884b54647.fontdata"]
 
 [params]
 

BIN
assets/fonts/crimes.ttf


+ 12 - 5
assets/scenes/logo.gd

@@ -1,8 +1,15 @@
-extends TextureRect
+extends RichTextLabel
 
+const REGULAR_TEXT = "THE LAST SHIFT"
+const HIGHLIGHT_TEXT = "THE L[color=#ff0000]A[/color]ST SH[color=#ff0000]I[/color]FT"
+
+var highlighted = false
 
 func _on_timer_timeout():
-	if randf() < 0.1:
-		texture.current_frame = 1
-	else:
-		texture.current_frame = 0
+	if highlighted:
+		if randf() < 0.3:
+			highlighted = false
+			text = REGULAR_TEXT
+	elif randf() < 0.15:
+		highlighted = true
+		text = HIGHLIGHT_TEXT

+ 15 - 16
assets/scenes/logo.tscn

@@ -1,22 +1,21 @@
-[gd_scene load_steps=5 format=3 uid="uid://bq2tsg7ic7l6h"]
+[gd_scene load_steps=3 format=3 uid="uid://bq2tsg7ic7l6h"]
 
-[ext_resource type="Texture2D" uid="uid://b4cgnkp8rrngn" path="res://assets/textures/logo-black.png" id="1_36ime"]
+[ext_resource type="FontFile" uid="uid://cqtognhaksl7j" path="res://assets/fonts/Potra.ttf" id="1_d0vvx"]
 [ext_resource type="Script" path="res://assets/scenes/logo.gd" id="1_lrvxc"]
-[ext_resource type="Texture2D" uid="uid://c8u4qq28kad8n" path="res://assets/textures/logo-red.png" id="2_5hq8e"]
 
-[sub_resource type="AnimatedTexture" id="AnimatedTexture_ht0ny"]
-frames = 2
-pause = true
-speed_scale = 0.0
-frame_0/texture = ExtResource("1_36ime")
-frame_1/texture = ExtResource("2_5hq8e")
-frame_1/duration = 1.0
-
-[node name="Logo" type="TextureRect"]
-offset_right = 809.0
-offset_bottom = 83.0
-texture = SubResource("AnimatedTexture_ht0ny")
-stretch_mode = 4
+[node name="Logo" type="RichTextLabel"]
+offset_right = 578.0
+offset_bottom = 95.0
+theme_override_fonts/normal_font = ExtResource("1_d0vvx")
+theme_override_font_sizes/normal_font_size = 128
+bbcode_enabled = true
+text = "THE LAST SHIFT"
+fit_content = true
+scroll_active = false
+autowrap_mode = 0
+shortcut_keys_enabled = false
+deselect_on_focus_loss_enabled = false
+drag_and_drop_selection_enabled = false
 script = ExtResource("1_lrvxc")
 
 [node name="Timer" type="Timer" parent="."]

+ 0 - 13
assets/scripts/config.gd

@@ -1,13 +0,0 @@
-class_name Config
-
-const FILE_NAME = "user://config.ini"
-
-static var content = ConfigFile.new()
-
-static func _static_init():
-	if content.load(FILE_NAME) != OK:
-		content.set_value("GENERAL", "SHOW_TUTORIAL", true)
-		content.save(FILE_NAME)
-
-static func save_changes():
-	content.save(FILE_NAME)

BIN
assets/textures/just_storefront.jpg


+ 4 - 4
assets/textures/logo-black.png.import → assets/textures/just_storefront.jpg.import

@@ -2,16 +2,16 @@
 
 importer="texture"
 type="CompressedTexture2D"
-uid="uid://b4cgnkp8rrngn"
-path="res://.godot/imported/logo-black.png-e038656327a96ae93c3e5645df165629.ctex"
+uid="uid://bsmaqakafb1h"
+path="res://.godot/imported/just_storefront.jpg-9fac345414e18e3b975a0e8a72b0b67e.ctex"
 metadata={
 "vram_texture": false
 }
 
 [deps]
 
-source_file="res://assets/textures/logo-black.png"
-dest_files=["res://.godot/imported/logo-black.png-e038656327a96ae93c3e5645df165629.ctex"]
+source_file="res://assets/textures/just_storefront.jpg"
+dest_files=["res://.godot/imported/just_storefront.jpg-9fac345414e18e3b975a0e8a72b0b67e.ctex"]
 
 [params]
 

BIN
assets/textures/logo-black.png


BIN
assets/textures/logo-red.png


BIN
assets/textures/menu_background.jpg


+ 4 - 4
assets/textures/logo-red.png.import → assets/textures/menu_background.jpg.import

@@ -2,16 +2,16 @@
 
 importer="texture"
 type="CompressedTexture2D"
-uid="uid://c8u4qq28kad8n"
-path="res://.godot/imported/logo-red.png-f888afbb3cfe03d5a5b3e440f1c91bcd.ctex"
+uid="uid://b6nsk6rd8a7sn"
+path="res://.godot/imported/menu_background.jpg-e5477b787844d9c1135a0b42fa6c711d.ctex"
 metadata={
 "vram_texture": false
 }
 
 [deps]
 
-source_file="res://assets/textures/logo-red.png"
-dest_files=["res://.godot/imported/logo-red.png-f888afbb3cfe03d5a5b3e440f1c91bcd.ctex"]
+source_file="res://assets/textures/menu_background.jpg"
+dest_files=["res://.godot/imported/menu_background.jpg-e5477b787844d9c1135a0b42fa6c711d.ctex"]
 
 [params]
 

+ 3 - 1
project.godot

@@ -16,12 +16,14 @@ config/features=PackedStringArray("4.2", "GL Compatibility")
 
 [autoload]
 
-GlobalInput="*res://assets/autoload/global_input.tscn"
+GlobalInput="*res://assets/autoload/global_input.gd"
+Config="*res://assets/autoload/config.gd"
 
 [display]
 
 window/size/viewport_width=1280
 window/size/viewport_height=720
+window/stretch/mode="canvas_items"
 
 [input]
 

+ 33 - 20
screens/main_menu.tscn

@@ -1,7 +1,13 @@
-[gd_scene load_steps=3 format=3 uid="uid://bnug1ybm5mlyd"]
+[gd_scene load_steps=6 format=3 uid="uid://bnug1ybm5mlyd"]
 
 [ext_resource type="Script" path="res://screens/main_menu.gd" id="1_6qk7l"]
+[ext_resource type="Texture2D" uid="uid://b6nsk6rd8a7sn" path="res://assets/textures/menu_background.jpg" id="2_6qrvo"]
 [ext_resource type="PackedScene" uid="uid://bq2tsg7ic7l6h" path="res://assets/scenes/logo.tscn" id="2_tr1i0"]
+[ext_resource type="FontFile" uid="uid://cqtognhaksl7j" path="res://assets/fonts/Potra.ttf" id="4_e6syc"]
+
+[sub_resource type="LabelSettings" id="LabelSettings_b3san"]
+font = ExtResource("4_e6syc")
+font_size = 42
 
 [node name="MainMenu" type="Control"]
 layout_mode = 3
@@ -12,30 +18,26 @@ grow_horizontal = 2
 grow_vertical = 2
 script = ExtResource("1_6qk7l")
 
+[node name="Background" type="TextureRect" parent="."]
+layout_mode = 0
+offset_right = 40.0
+offset_bottom = 40.0
+texture = ExtResource("2_6qrvo")
+
 [node name="Logo" parent="." instance=ExtResource("2_tr1i0")]
 layout_mode = 1
-anchors_preset = 5
-anchor_left = 0.5
-anchor_right = 0.5
-offset_left = -404.0
-offset_top = 83.0
-offset_right = 405.0
-offset_bottom = 166.0
-grow_horizontal = 2
+offset_left = 56.0
+offset_top = 59.0
+offset_right = 982.0
+offset_bottom = 211.0
+scale = Vector2(0.856422, 0.698644)
 
 [node name="Buttons" type="VBoxContainer" parent="."]
 layout_mode = 1
-anchors_preset = 8
-anchor_left = 0.5
-anchor_top = 0.5
-anchor_right = 0.5
-anchor_bottom = 0.5
-offset_left = -100.0
-offset_top = -90.0
-offset_right = 100.0
-offset_bottom = 90.0
-grow_horizontal = 2
-grow_vertical = 2
+offset_left = 343.0
+offset_top = 276.0
+offset_right = 532.0
+offset_bottom = 456.0
 
 [node name="NewGame" type="Button" parent="Buttons"]
 layout_mode = 2
@@ -59,6 +61,17 @@ text = "CREDITS"
 layout_mode = 2
 text = "QUIT"
 
+[node name="Authors" type="Label" parent="."]
+layout_mode = 0
+offset_left = 210.0
+offset_top = 544.0
+offset_right = 682.0
+offset_bottom = 649.0
+text = "A GAME BY:
+LORDDRAKO & UGLIBOY"
+label_settings = SubResource("LabelSettings_b3san")
+horizontal_alignment = 1
+
 [connection signal="pressed" from="Buttons/NewGame" to="." method="_on_new_game_pressed"]
 [connection signal="pressed" from="Buttons/Settings" to="." method="_on_settings_pressed"]
 [connection signal="pressed" from="Buttons/Quit" to="." method="_on_quit_pressed"]

+ 4 - 7
screens/settings_menu.gd

@@ -3,15 +3,12 @@ extends PanelContainer
 const GENERAL = "GENERAL"
 const SHOW_TUTORIAL = "SHOW_TUTORIAL"
 
-var original_state = {}
-
 @onready var show_tutorial = $MarginContainer/VBoxContainer/Tabs/General/GridContainer/TutorialCheckBox
 @onready var discard_button = $MarginContainer/VBoxContainer/Buttons/Discard
 
 func _ready():
 	discard_button.text = "BACK"
-	original_state[SHOW_TUTORIAL] = Config.content.get_value("GENERAL", SHOW_TUTORIAL)
-	show_tutorial.button_pressed = original_state[SHOW_TUTORIAL]
+	show_tutorial.button_pressed = Config.show_tutorial
 	
 func _process(_delta):
 	if Input.is_action_just_pressed("ui_cancel"):
@@ -21,11 +18,11 @@ func _on_discard_pressed():
 	get_tree().change_scene_to_file("res://screens/main_menu.tscn")
 	
 func _on_save_pressed():
-	Config.content.set_value(GENERAL, SHOW_TUTORIAL, show_tutorial.button_pressed)
-	Config.save_changes()
+	Config.show_tutorial = show_tutorial.button_pressed
+	Config.save()
 	get_tree().change_scene_to_file("res://screens/main_menu.tscn")
 	
 func update_discard_button():
 	var dirty = \
-		original_state[SHOW_TUTORIAL] != show_tutorial.button_pressed
+		Config.show_tutorial != show_tutorial.button_pressed
 	discard_button.text = "DISCARD" if dirty else "BACK"