Saving & loading,
This commit is contained in:
parent
b13cf3d96b
commit
04d50df23e
12 changed files with 336 additions and 11 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=41 format=4 uid="uid://bauklhpieuivd"]
|
[gd_scene load_steps=45 format=4 uid="uid://bauklhpieuivd"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://d0qswyhwbhdua" path="res://scripts/game.gd" id="1_u5sy4"]
|
[ext_resource type="Script" uid="uid://d0qswyhwbhdua" path="res://scripts/game.gd" id="1_u5sy4"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dtwo7g0ipc4k" path="res://textures/ship_1.png" id="1_uwrxv"]
|
[ext_resource type="Texture2D" uid="uid://dtwo7g0ipc4k" path="res://textures/ship_1.png" id="1_uwrxv"]
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
[ext_resource type="Script" uid="uid://dqiaioigmj5wb" path="res://scripts/pause_menu.gd" id="15_rysoc"]
|
[ext_resource type="Script" uid="uid://dqiaioigmj5wb" path="res://scripts/pause_menu.gd" id="15_rysoc"]
|
||||||
[ext_resource type="FontFile" uid="uid://donsvh2l775rb" path="res://fonts/Doto.ttf" id="16_1kice"]
|
[ext_resource type="FontFile" uid="uid://donsvh2l775rb" path="res://fonts/Doto.ttf" id="16_1kice"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cy4nbqbm222os" path="res://scenes/settings.tscn" id="17_ssvqc"]
|
[ext_resource type="PackedScene" uid="uid://cy4nbqbm222os" path="res://scenes/settings.tscn" id="17_ssvqc"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cwa4uu7hrw2l0" path="res://textures/save_indicator.png" id="22_bt5mj"]
|
||||||
|
|
||||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ir15t"]
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ir15t"]
|
||||||
texture = ExtResource("12_trtic")
|
texture = ExtResource("12_trtic")
|
||||||
|
|
@ -86,6 +87,28 @@ corner_detail = 1
|
||||||
font_size = 48
|
font_size = 48
|
||||||
outline_size = 2
|
outline_size = 2
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_vuhkc"]
|
||||||
|
atlas = ExtResource("22_bt5mj")
|
||||||
|
region = Rect2(0, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_26mqe"]
|
||||||
|
atlas = ExtResource("22_bt5mj")
|
||||||
|
region = Rect2(16, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_e1j6l"]
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_vuhkc")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_26mqe")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"default",
|
||||||
|
"speed": 2.0
|
||||||
|
}]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_trtic"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_trtic"]
|
||||||
shader = ExtResource("12_kvuet")
|
shader = ExtResource("12_kvuet")
|
||||||
shader_parameter/shake = 0.002000000095
|
shader_parameter/shake = 0.002000000095
|
||||||
|
|
@ -704,6 +727,26 @@ script = ExtResource("15_ca42v")
|
||||||
action_name = "navpanel"
|
action_name = "navpanel"
|
||||||
metadata/_custom_type_script = "uid://b2maxk5g6yb0i"
|
metadata/_custom_type_script = "uid://b2maxk5g6yb0i"
|
||||||
|
|
||||||
|
[node name="SaveIndicator" type="Control" parent="UI/Control"]
|
||||||
|
visible = false
|
||||||
|
custom_minimum_size = Vector2(64, 64)
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 3
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = -64.0
|
||||||
|
offset_top = -64.0
|
||||||
|
grow_horizontal = 0
|
||||||
|
grow_vertical = 0
|
||||||
|
|
||||||
|
[node name="SaveIcon" type="AnimatedSprite2D" parent="UI/Control/SaveIndicator"]
|
||||||
|
position = Vector2(32, 32)
|
||||||
|
scale = Vector2(4, 4)
|
||||||
|
sprite_frames = SubResource("SpriteFrames_e1j6l")
|
||||||
|
autoplay = "default"
|
||||||
|
|
||||||
[node name="FadeToBlack" type="ColorRect" parent="UI"]
|
[node name="FadeToBlack" type="ColorRect" parent="UI"]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
modulate = Color(1, 1, 1, 0)
|
modulate = Color(1, 1, 1, 0)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=27 format=3 uid="uid://by43ihcec8e8q"]
|
[gd_scene load_steps=31 format=3 uid="uid://by43ihcec8e8q"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://b2sw6ymaf4t0s" path="res://scripts/game_ground.gd" id="1_6ra5r"]
|
[ext_resource type="Script" uid="uid://b2sw6ymaf4t0s" path="res://scripts/game_ground.gd" id="1_6ra5r"]
|
||||||
[ext_resource type="Script" uid="uid://dowu512otgyyf" path="res://scripts/player_ground.gd" id="3_8gbjj"]
|
[ext_resource type="Script" uid="uid://dowu512otgyyf" path="res://scripts/player_ground.gd" id="3_8gbjj"]
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
[ext_resource type="Shader" uid="uid://d3hoh7ec2w8q7" path="res://scripts/outline.gdshader" id="7_vuhkc"]
|
[ext_resource type="Shader" uid="uid://d3hoh7ec2w8q7" path="res://scripts/outline.gdshader" id="7_vuhkc"]
|
||||||
[ext_resource type="Shader" uid="uid://d2e0541hawkml" path="res://scripts/vignette.gdshader" id="9_5vwr8"]
|
[ext_resource type="Shader" uid="uid://d2e0541hawkml" path="res://scripts/vignette.gdshader" id="9_5vwr8"]
|
||||||
[ext_resource type="Shader" uid="uid://bk7q00br1ms30" path="res://scripts/retro.gdshader" id="9_257nh"]
|
[ext_resource type="Shader" uid="uid://bk7q00br1ms30" path="res://scripts/retro.gdshader" id="9_257nh"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cwa4uu7hrw2l0" path="res://textures/save_indicator.png" id="13_176r3"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dauoebs801ngm" path="res://addons/super_awesome_input_icons/textures/keyboard/question.png" id="16_e3s4u"]
|
[ext_resource type="Texture2D" uid="uid://dauoebs801ngm" path="res://addons/super_awesome_input_icons/textures/keyboard/question.png" id="16_e3s4u"]
|
||||||
[ext_resource type="Script" uid="uid://b2maxk5g6yb0i" path="res://addons/super_awesome_input_icons/classes/input_icon_texture_rect.gd" id="16_hby33"]
|
[ext_resource type="Script" uid="uid://b2maxk5g6yb0i" path="res://addons/super_awesome_input_icons/classes/input_icon_texture_rect.gd" id="16_hby33"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dhcfrsf726k68" path="res://scenes/dialogue_select_button.tscn" id="19_qqas2"]
|
[ext_resource type="PackedScene" uid="uid://dhcfrsf726k68" path="res://scenes/dialogue_select_button.tscn" id="19_qqas2"]
|
||||||
|
|
@ -108,6 +109,28 @@ font_size = 48
|
||||||
outline_size = 4
|
outline_size = 4
|
||||||
outline_color = Color(0, 0, 0, 1)
|
outline_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_vuhkc"]
|
||||||
|
atlas = ExtResource("13_176r3")
|
||||||
|
region = Rect2(0, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_26mqe"]
|
||||||
|
atlas = ExtResource("13_176r3")
|
||||||
|
region = Rect2(16, 0, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_257nh"]
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_vuhkc")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_26mqe")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"default",
|
||||||
|
"speed": 2.0
|
||||||
|
}]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ypt7u"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ypt7u"]
|
||||||
shader = ExtResource("9_257nh")
|
shader = ExtResource("9_257nh")
|
||||||
shader_parameter/shake = 0.002000000095
|
shader_parameter/shake = 0.002000000095
|
||||||
|
|
@ -303,6 +326,27 @@ metadata/_custom_type_script = "uid://b2maxk5g6yb0i"
|
||||||
[node name="Button" parent="UI/Control/DialogueOptions" instance=ExtResource("19_qqas2")]
|
[node name="Button" parent="UI/Control/DialogueOptions" instance=ExtResource("19_qqas2")]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="SaveIndicator" type="Control" parent="UI/Control"]
|
||||||
|
visible = false
|
||||||
|
custom_minimum_size = Vector2(64, 64)
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 3
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = -64.0
|
||||||
|
offset_top = -64.0
|
||||||
|
grow_horizontal = 0
|
||||||
|
grow_vertical = 0
|
||||||
|
|
||||||
|
[node name="SaveIcon" type="AnimatedSprite2D" parent="UI/Control/SaveIndicator"]
|
||||||
|
position = Vector2(32, 32)
|
||||||
|
scale = Vector2(4, 4)
|
||||||
|
sprite_frames = SubResource("SpriteFrames_257nh")
|
||||||
|
autoplay = "default"
|
||||||
|
frame_progress = 0.42345548
|
||||||
|
|
||||||
[node name="Shader" type="ColorRect" parent="UI"]
|
[node name="Shader" type="ColorRect" parent="UI"]
|
||||||
material = SubResource("ShaderMaterial_ypt7u")
|
material = SubResource("ShaderMaterial_ypt7u")
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=12 format=3 uid="uid://b1x7evhkxm385"]
|
[gd_scene load_steps=13 format=3 uid="uid://b1x7evhkxm385"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://md1biuc6ygmv" path="res://scripts/title.gd" id="1_pyl7j"]
|
[ext_resource type="Script" uid="uid://md1biuc6ygmv" path="res://scripts/title.gd" id="1_pyl7j"]
|
||||||
[ext_resource type="FontFile" uid="uid://n1nd5m2kwexu" path="res://fonts/Michroma.ttf" id="1_wosw1"]
|
[ext_resource type="FontFile" uid="uid://n1nd5m2kwexu" path="res://fonts/Michroma.ttf" id="1_wosw1"]
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
[ext_resource type="Shader" uid="uid://bk7q00br1ms30" path="res://scripts/retro.gdshader" id="2_p6dhs"]
|
[ext_resource type="Shader" uid="uid://bk7q00br1ms30" path="res://scripts/retro.gdshader" id="2_p6dhs"]
|
||||||
[ext_resource type="Script" uid="uid://b2maxk5g6yb0i" path="res://addons/super_awesome_input_icons/classes/input_icon_texture_rect.gd" id="2_pyl7j"]
|
[ext_resource type="Script" uid="uid://b2maxk5g6yb0i" path="res://addons/super_awesome_input_icons/classes/input_icon_texture_rect.gd" id="2_pyl7j"]
|
||||||
[ext_resource type="FontFile" uid="uid://donsvh2l775rb" path="res://fonts/Doto.ttf" id="3_b3w7a"]
|
[ext_resource type="FontFile" uid="uid://donsvh2l775rb" path="res://fonts/Doto.ttf" id="3_b3w7a"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://bff3l15ivkcyi" path="res://sounds/ui_back.mp3" id="3_w65of"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cy4nbqbm222os" path="res://scenes/settings.tscn" id="6_yql1r"]
|
[ext_resource type="PackedScene" uid="uid://cy4nbqbm222os" path="res://scenes/settings.tscn" id="6_yql1r"]
|
||||||
|
|
||||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_yql1r"]
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_yql1r"]
|
||||||
|
|
@ -40,6 +41,9 @@ script = ExtResource("1_pyl7j")
|
||||||
[node name="UiSelect" type="AudioStreamPlayer" parent="."]
|
[node name="UiSelect" type="AudioStreamPlayer" parent="."]
|
||||||
stream = ExtResource("2_hiwto")
|
stream = ExtResource("2_hiwto")
|
||||||
|
|
||||||
|
[node name="UiBack" type="AudioStreamPlayer" parent="."]
|
||||||
|
stream = ExtResource("3_w65of")
|
||||||
|
|
||||||
[node name="Title" type="AudioStreamPlayer" parent="."]
|
[node name="Title" type="AudioStreamPlayer" parent="."]
|
||||||
stream = ExtResource("2_ia1n6")
|
stream = ExtResource("2_ia1n6")
|
||||||
volume_db = -4.0
|
volume_db = -4.0
|
||||||
|
|
@ -306,7 +310,61 @@ theme_override_font_sizes/bold_italics_font_size = 32
|
||||||
theme_override_font_sizes/italics_font_size = 32
|
theme_override_font_sizes/italics_font_size = 32
|
||||||
theme_override_font_sizes/mono_font_size = 32
|
theme_override_font_sizes/mono_font_size = 32
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
text = "[font size=20]soundtrack by delosound on pixabay[/font]"
|
text = "[font size=20]space ambient music: minecraft nether music (by C418)[/font]"
|
||||||
|
fit_content = true
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="Label5" type="RichTextLabel" parent="UI/Control/Credits"]
|
||||||
|
custom_minimum_size = Vector2(640, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
size_flags_vertical = 4
|
||||||
|
theme_override_fonts/normal_font = ExtResource("1_wosw1")
|
||||||
|
theme_override_fonts/bold_font = ExtResource("3_b3w7a")
|
||||||
|
theme_override_font_sizes/normal_font_size = 32
|
||||||
|
theme_override_font_sizes/bold_font_size = 32
|
||||||
|
theme_override_font_sizes/bold_italics_font_size = 32
|
||||||
|
theme_override_font_sizes/italics_font_size = 32
|
||||||
|
theme_override_font_sizes/mono_font_size = 32
|
||||||
|
bbcode_enabled = true
|
||||||
|
text = "[font size=20]space station music: SCP-3008 soundtrack by uglyburger0[/font]"
|
||||||
|
fit_content = true
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="Label6" type="RichTextLabel" parent="UI/Control/Credits"]
|
||||||
|
custom_minimum_size = Vector2(640, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
size_flags_vertical = 4
|
||||||
|
theme_override_fonts/normal_font = ExtResource("1_wosw1")
|
||||||
|
theme_override_fonts/bold_font = ExtResource("3_b3w7a")
|
||||||
|
theme_override_font_sizes/normal_font_size = 32
|
||||||
|
theme_override_font_sizes/bold_font_size = 32
|
||||||
|
theme_override_font_sizes/bold_italics_font_size = 32
|
||||||
|
theme_override_font_sizes/italics_font_size = 32
|
||||||
|
theme_override_font_sizes/mono_font_size = 32
|
||||||
|
bbcode_enabled = true
|
||||||
|
text = "[font size=20]title screen music: delosound on pixabay[/font]"
|
||||||
|
fit_content = true
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="Label7" type="RichTextLabel" parent="UI/Control/Credits"]
|
||||||
|
custom_minimum_size = Vector2(640, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
size_flags_vertical = 4
|
||||||
|
theme_override_fonts/normal_font = ExtResource("1_wosw1")
|
||||||
|
theme_override_fonts/bold_font = ExtResource("3_b3w7a")
|
||||||
|
theme_override_font_sizes/normal_font_size = 32
|
||||||
|
theme_override_font_sizes/bold_font_size = 32
|
||||||
|
theme_override_font_sizes/bold_italics_font_size = 32
|
||||||
|
theme_override_font_sizes/italics_font_size = 32
|
||||||
|
theme_override_font_sizes/mono_font_size = 32
|
||||||
|
bbcode_enabled = true
|
||||||
|
text = "[font size=20]special thanks to hack club for getting me to finish projects for once[/font]"
|
||||||
fit_content = true
|
fit_content = true
|
||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
|
|
@ -446,7 +504,10 @@ color = Color(1, 1, 1, 0)
|
||||||
|
|
||||||
[connection signal="pressed" from="UI/Control/ControllerInfo/Box/Flow/Continue" to="." method="_on_continue_pressed"]
|
[connection signal="pressed" from="UI/Control/ControllerInfo/Box/Flow/Continue" to="." method="_on_continue_pressed"]
|
||||||
[connection signal="pressed" from="UI/Control/Title/Buttons/NewGame" to="." method="_on_new_game_pressed"]
|
[connection signal="pressed" from="UI/Control/Title/Buttons/NewGame" to="." method="_on_new_game_pressed"]
|
||||||
|
[connection signal="pressed" from="UI/Control/Title/Buttons/LoadGame" to="." method="_on_load_game_pressed"]
|
||||||
[connection signal="pressed" from="UI/Control/Title/Buttons/Settings" to="." method="_on_settings_pressed"]
|
[connection signal="pressed" from="UI/Control/Title/Buttons/Settings" to="." method="_on_settings_pressed"]
|
||||||
[connection signal="pressed" from="UI/Control/Title/Buttons/Credits" to="." method="_on_credits_pressed"]
|
[connection signal="pressed" from="UI/Control/Title/Buttons/Credits" to="." method="_on_credits_pressed"]
|
||||||
[connection signal="pressed" from="UI/Control/Title/Buttons/Quit" to="." method="_on_quit_pressed"]
|
[connection signal="pressed" from="UI/Control/Title/Buttons/Quit" to="." method="_on_quit_pressed"]
|
||||||
[connection signal="pressed" from="UI/Control/Credits/Buttons/ExitCredits" to="." method="_on_exit_credits_pressed"]
|
[connection signal="pressed" from="UI/Control/Credits/Buttons/ExitCredits" to="." method="_on_exit_credits_pressed"]
|
||||||
|
[connection signal="pressed" from="UI/Control/OverrideSave/Buttons/YesOverride" to="." method="_on_yes_override_pressed"]
|
||||||
|
[connection signal="pressed" from="UI/Control/OverrideSave/Buttons/NoOverride" to="." method="_on_no_override_pressed"]
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,8 @@ func _interact(player: Node2D) -> void:
|
||||||
else:
|
else:
|
||||||
await game.dialogue("Sorry, but you don't have enough marks for that.")
|
await game.dialogue("Sorry, but you don't have enough marks for that.")
|
||||||
|
|
||||||
|
game.save_game()
|
||||||
|
|
||||||
player.get_node("Camera").enabled = true
|
player.get_node("Camera").enabled = true
|
||||||
$Camera.enabled = false
|
$Camera.enabled = false
|
||||||
$InteractArea.monitoring = true
|
$InteractArea.monitoring = true
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,21 @@ func world_to_chunk(position: Vector2) -> Vector2:
|
||||||
func chunk_to_world(position: Vector2) -> Vector2:
|
func chunk_to_world(position: Vector2) -> Vector2:
|
||||||
return Vector2(floori(position.x * 1024), floori(position.y * 1024))
|
return Vector2(floori(position.x * 1024), floori(position.y * 1024))
|
||||||
|
|
||||||
|
## Saves the game.
|
||||||
|
func save_game() -> void:
|
||||||
|
$UI/Control/SaveIndicator.visible = true
|
||||||
|
|
||||||
|
global.stats.position = {
|
||||||
|
"x": $Player.global_position.x,
|
||||||
|
"y": $Player.global_position.y
|
||||||
|
}
|
||||||
|
|
||||||
|
global.save_game()
|
||||||
|
|
||||||
|
await get_tree().create_timer(2).timeout
|
||||||
|
|
||||||
|
$UI/Control/SaveIndicator.visible = false
|
||||||
|
|
||||||
func enter_physical(map):
|
func enter_physical(map):
|
||||||
get_tree().paused = true
|
get_tree().paused = true
|
||||||
|
|
||||||
|
|
@ -110,6 +125,14 @@ func _ready() -> void:
|
||||||
|
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
|
if global.stats.position:
|
||||||
|
$Player.global_position.x = global.stats.position.x
|
||||||
|
$Player.global_position.y = global.stats.position.y
|
||||||
|
|
||||||
|
global.stats.position = null
|
||||||
|
else:
|
||||||
|
save_game()
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
if get_tree().paused:
|
if get_tree().paused:
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,20 @@ var dialogue_speed = {
|
||||||
"player_woozy": 0.2,
|
"player_woozy": 0.2,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func save_game() -> void:
|
||||||
|
$UI/Control/SaveIndicator.visible = true
|
||||||
|
|
||||||
|
global.stats.position = {
|
||||||
|
"x": $PlayerGround.global_position.x,
|
||||||
|
"y": $PlayerGround.global_position.y
|
||||||
|
}
|
||||||
|
|
||||||
|
global.save_game()
|
||||||
|
|
||||||
|
await get_tree().create_timer(2).timeout
|
||||||
|
|
||||||
|
$UI/Control/SaveIndicator.visible = false
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
$UI/Control/Dialogue.visible = false
|
$UI/Control/Dialogue.visible = false
|
||||||
|
|
||||||
|
|
@ -41,6 +55,12 @@ func _ready() -> void:
|
||||||
|
|
||||||
location_scene.free()
|
location_scene.free()
|
||||||
|
|
||||||
|
if global.stats.position:
|
||||||
|
$PlayerGround.global_position.x = global.stats.position.x
|
||||||
|
$PlayerGround.global_position.y = global.stats.position.y
|
||||||
|
|
||||||
|
global.stats.position = null
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
if current_interaction_area:
|
if current_interaction_area:
|
||||||
$UI/Control/Interact.visible = true
|
$UI/Control/Interact.visible = true
|
||||||
|
|
|
||||||
|
|
@ -74,8 +74,7 @@ func load_game():
|
||||||
print("JSON Parse Error: ", json.get_error_message(), " in ", parse_result, " at line ", json.get_error_line())
|
print("JSON Parse Error: ", json.get_error_message(), " in ", parse_result, " at line ", json.get_error_line())
|
||||||
return
|
return
|
||||||
|
|
||||||
if json.data.settings: settings = json.data.settings
|
if json.data.stats: stats = json.data.stats
|
||||||
if json.data.stats: settings = json.data.stats
|
|
||||||
|
|
||||||
func load_settings():
|
func load_settings():
|
||||||
if not FileAccess.file_exists("user://settings.json"):
|
if not FileAccess.file_exists("user://settings.json"):
|
||||||
|
|
@ -107,8 +106,8 @@ var default_stats = {
|
||||||
"boost_tank_size": 1,
|
"boost_tank_size": 1,
|
||||||
"marks": 200,
|
"marks": 200,
|
||||||
"location": "space",
|
"location": "space",
|
||||||
"ship_position": Vector2(),
|
"position": Vector2(),
|
||||||
"ship_rotation": 0,
|
"rotation": 0,
|
||||||
"story_progress": 1,
|
"story_progress": 1,
|
||||||
"navigation_goal": null,
|
"navigation_goal": null,
|
||||||
"equipped_ground_gun": "pistol"
|
"equipped_ground_gun": "pistol"
|
||||||
|
|
|
||||||
|
|
@ -198,3 +198,5 @@ func _ground_ready() -> void:
|
||||||
game.set_vignette_parameter("softness", i * 0.04)
|
game.set_vignette_parameter("softness", i * 0.04)
|
||||||
|
|
||||||
i += 2
|
i += 2
|
||||||
|
else:
|
||||||
|
game.save_game()
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ func _on_credits_pressed() -> void:
|
||||||
func _on_exit_credits_pressed() -> void:
|
func _on_exit_credits_pressed() -> void:
|
||||||
if transitioning: return
|
if transitioning: return
|
||||||
|
|
||||||
$UiSelect.play()
|
$UiBack.play()
|
||||||
|
|
||||||
transitioning = true
|
transitioning = true
|
||||||
|
|
||||||
|
|
@ -174,7 +174,7 @@ func _on_settings_pressed() -> void:
|
||||||
func _on_settings_back_pressed() -> void:
|
func _on_settings_back_pressed() -> void:
|
||||||
if transitioning: return
|
if transitioning: return
|
||||||
|
|
||||||
$UiSelect.play()
|
$UiBack.play()
|
||||||
|
|
||||||
transitioning = true
|
transitioning = true
|
||||||
|
|
||||||
|
|
@ -227,7 +227,7 @@ func _on_new_game_pressed() -> void:
|
||||||
|
|
||||||
$UI/Control/Title.visible = false
|
$UI/Control/Title.visible = false
|
||||||
|
|
||||||
if global.stats.loaded:
|
if FileAccess.file_exists("user://savegame.save"):
|
||||||
$UI/Control/OverrideSave.visible = true
|
$UI/Control/OverrideSave.visible = true
|
||||||
|
|
||||||
$UI/Control/OverrideSave.modulate.a = 0
|
$UI/Control/OverrideSave.modulate.a = 0
|
||||||
|
|
@ -243,9 +243,100 @@ func _on_new_game_pressed() -> void:
|
||||||
|
|
||||||
$UI/Control/OverrideSave/Buttons/NoOverride.grab_focus()
|
$UI/Control/OverrideSave/Buttons/NoOverride.grab_focus()
|
||||||
|
|
||||||
|
transitioning = false
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
if global.stats.location == "space":
|
if global.stats.location == "space":
|
||||||
get_tree().change_scene_to_file("res://scenes/game.tscn")
|
get_tree().change_scene_to_file("res://scenes/game.tscn")
|
||||||
else:
|
else:
|
||||||
get_tree().change_scene_to_file("res://scenes/ground.tscn")
|
get_tree().change_scene_to_file("res://scenes/ground.tscn")
|
||||||
|
|
||||||
|
func _on_load_game_pressed() -> void:
|
||||||
|
if transitioning: return
|
||||||
|
|
||||||
|
$UiSelect.play()
|
||||||
|
|
||||||
|
transitioning = true
|
||||||
|
|
||||||
|
get_viewport().gui_release_focus()
|
||||||
|
var i = 0
|
||||||
|
|
||||||
|
while i < 6:
|
||||||
|
$UI/Control/Title.modulate.a -= 0.2
|
||||||
|
|
||||||
|
await get_tree().create_timer(0.2).timeout
|
||||||
|
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
$UI/Control/Title.visible = false
|
||||||
|
|
||||||
|
await global.load_game()
|
||||||
|
|
||||||
|
if global.stats.location == "space":
|
||||||
|
get_tree().change_scene_to_file("res://scenes/game.tscn")
|
||||||
|
else:
|
||||||
|
get_tree().change_scene_to_file("res://scenes/ground.tscn")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_yes_override_pressed() -> void:
|
||||||
|
if transitioning: return
|
||||||
|
|
||||||
|
$UiSelect.play()
|
||||||
|
|
||||||
|
transitioning = true
|
||||||
|
|
||||||
|
get_viewport().gui_release_focus()
|
||||||
|
var i = 0
|
||||||
|
|
||||||
|
while i < 6:
|
||||||
|
$UI/Control/OverrideSave.modulate.a -= 0.2
|
||||||
|
|
||||||
|
await get_tree().create_timer(0.2).timeout
|
||||||
|
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
$UI/Control/OverrideSave.visible = false
|
||||||
|
|
||||||
|
global.stats = global.default_stats.duplicate_deep()
|
||||||
|
|
||||||
|
if global.stats.location == "space":
|
||||||
|
get_tree().change_scene_to_file("res://scenes/game.tscn")
|
||||||
|
else:
|
||||||
|
get_tree().change_scene_to_file("res://scenes/ground.tscn")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_no_override_pressed() -> void:
|
||||||
|
if transitioning: return
|
||||||
|
|
||||||
|
$UiBack.play()
|
||||||
|
|
||||||
|
transitioning = true
|
||||||
|
|
||||||
|
get_viewport().gui_release_focus()
|
||||||
|
var i = 0
|
||||||
|
|
||||||
|
while i < 6:
|
||||||
|
$UI/Control/OverrideSave.modulate.a -= 0.2
|
||||||
|
|
||||||
|
await get_tree().create_timer(0.2).timeout
|
||||||
|
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
$UI/Control/OverrideSave.visible = false
|
||||||
|
$UI/Control/Title.visible = true
|
||||||
|
|
||||||
|
$UI/Control/Title.modulate.a = 0
|
||||||
|
|
||||||
|
i = 0
|
||||||
|
|
||||||
|
while i < 6:
|
||||||
|
$UI/Control/Title.modulate.a += 0.2
|
||||||
|
|
||||||
|
await get_tree().create_timer(0.2).timeout
|
||||||
|
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
$UI/Control/Title/Buttons/NewGame.grab_focus()
|
||||||
|
|
||||||
transitioning = false
|
transitioning = false
|
||||||
|
|
|
||||||
BIN
textures/save_indicator.ase
Normal file
BIN
textures/save_indicator.ase
Normal file
Binary file not shown.
BIN
textures/save_indicator.png
Normal file
BIN
textures/save_indicator.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 224 B |
40
textures/save_indicator.png.import
Normal file
40
textures/save_indicator.png.import
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://cwa4uu7hrw2l0"
|
||||||
|
path="res://.godot/imported/save_indicator.png-9ea36dce7f4f02849ef94f4ba75ec5ee.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://textures/save_indicator.png"
|
||||||
|
dest_files=["res://.godot/imported/save_indicator.png-9ea36dce7f4f02849ef94f4ba75ec5ee.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
Loading…
Reference in a new issue