savesystem
This commit is contained in:
parent
672a09d32e
commit
2061695212
18 changed files with 796 additions and 41 deletions
|
@ -14,10 +14,7 @@ func _ready():
|
|||
if Global.sk:
|
||||
_sk()
|
||||
else:
|
||||
if Global.firstrun:
|
||||
welcometext = "Welcome to your first session "+playername
|
||||
else:
|
||||
welcometext = "Welcome back "+playername
|
||||
welcometext = "Welcome "+playername
|
||||
if housefreedom:
|
||||
welcometext = welcometext+"\nValve corporation promotes enviromental pollution"
|
||||
if OS.get_environment("MANGOHUD").contains("1"):
|
||||
|
|
|
@ -43,10 +43,6 @@ var dcpchar = 0
|
|||
var mangohud = false
|
||||
var cspawnarea = [null, null]
|
||||
var owlocation = [[null, null], [null, null]]
|
||||
var hiscoresfile = "user://hiscores.save"
|
||||
var gamelevel
|
||||
var levelmax
|
||||
var firstrun
|
||||
const musictracks = ["res://music/midorinoyume.ogg", "res://music/seahorse.ogg", "res://music/chinesegoat.ogg", "res://music/doyoufeelold.ogg", "res://music/doyiuneedahealer.ogg", "res://music/adayatceres.ogg", "res://music/twintroublemakers.ogg", "res://music/easyquiz.ogg", "res://music/neowave.ogg", "res://music/multivectorsubmarines.ogg", "res://music/halfgeniegirls.ogg", "res://music/rusianmaverickfairy.ogg", "res://music/blacksmithofdestruction.ogg", "res://music/shininglikefireworks.ogg", "res://music/sadtrashcan.ogg", "res://music/akikoletter.ogg", "res://music/asadcat.ogg", "res://music/lilydesire.ogg", "res://music/scholartrip.ogg", "res://music/quantumice.ogg", "res://music/unreeeal.ogg", "res://music/alsa.ogg", "res://music/silverblue.ogg"]
|
||||
const sfxtracks = ["res://sfx/braindamage.wav", "res://sfx/gaugefill.wav", "res://sfx/boomboombakudan.wav"]
|
||||
var debug = false
|
||||
|
|
100
levels/ui/erase.gd
Normal file
100
levels/ui/erase.gd
Normal file
|
@ -0,0 +1,100 @@
|
|||
extends Control
|
||||
const gamepadtest = preload("res://gamepad.gd")
|
||||
const savegame = preload("res://save.gd")
|
||||
func _ready():
|
||||
#Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
|
||||
$VBoxContainer/Ram.grab_focus()
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
func _level():
|
||||
# This is like autoloading the scene, only
|
||||
# it happens after already loading the main scene.
|
||||
get_tree().change_scene_to_file("res://backgounds/disclaimer.tscn")
|
||||
#Global.live = 1
|
||||
#Global.gamelevel = randi() % 3
|
||||
#if Global.gamelevel == 0:
|
||||
# get_tree().change_scene_to_file("res://backgounds/galaxy.tscn")
|
||||
#elif Global.gamelevel == 1:
|
||||
# get_tree().change_scene_to_file("res://backgounds/wormhole.tscn")
|
||||
#else:
|
||||
# get_tree().change_scene_to_file("res://backgounds/abstract.tscn")
|
||||
#get_tree().root.add_child(title)
|
||||
#get_tree().root.remove_child(boot)
|
||||
#boot.queue_free()
|
||||
|
||||
func _input(event):
|
||||
gamepadtest.new(event)
|
||||
# Mouse in viewport coordinates.
|
||||
if Input.is_action_just_pressed("ui_cancel"):
|
||||
_on_back_pressed()
|
||||
#print("Mouse Click/Unclick at: ", event.position)
|
||||
# if highlighted == 1:
|
||||
# _on_debug_pressed()
|
||||
# if highlighted == 2:
|
||||
# _on_exit_pressed()
|
||||
# else:
|
||||
# _on_start_pressed()
|
||||
# elif Input.is_action_pressed("ui_up"):
|
||||
# focus_next
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_back_pressed():
|
||||
get_tree().change_scene_to_file("res://levels/ui/savefile.tscn")
|
||||
|
||||
func _on_ram_pressed() -> void:
|
||||
Global.dificulty = 0
|
||||
Global.quest = [0, 0, 0, 0, 0, 0]
|
||||
Global.cplace = [1, 11, 19]
|
||||
Global.live = 0
|
||||
Global.cpchar = 0
|
||||
Global.party = [[0,0], [null,null], [null,null], [null,null]]
|
||||
Global.ccutscene = 0
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_1_pressed() -> void:
|
||||
savegame.new(1, true)
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_2_pressed() -> void:
|
||||
savegame.new(2, true)
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_3_pressed() -> void:
|
||||
savegame.new(3, true)
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_4_pressed() -> void:
|
||||
savegame.new(4, true)
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_5_pressed() -> void:
|
||||
savegame.new(5, true)
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_6_pressed() -> void:
|
||||
savegame.new(6, true)
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_7_pressed() -> void:
|
||||
savegame.new(7, true)
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_8_pressed() -> void:
|
||||
savegame.new(8, true)
|
||||
_on_back_pressed()
|
123
levels/ui/erase.tscn
Normal file
123
levels/ui/erase.tscn
Normal file
|
@ -0,0 +1,123 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://dbdi41u4i0yy4"]
|
||||
|
||||
[ext_resource type="Script" path="res://levels/ui/erase.gd" id="1_csqu8"]
|
||||
[ext_resource type="Texture2D" uid="uid://bxa27c7gnivwx" path="res://backgounds/night-sky-at-ceres.jpg" id="2_6n1ip"]
|
||||
[ext_resource type="PackedScene" uid="uid://d31udhuuwrajn" path="res://levels/bottomhud.tscn" id="3_72nl0"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6u0xs"]
|
||||
bg_color = Color(0, 0.8, 0, 1)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_r2qrn"]
|
||||
bg_color = Color(0, 0.8, 0, 1)
|
||||
|
||||
[node name="Erase" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_csqu8")
|
||||
|
||||
[node name="Night Sky" type="TextureRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_right = 1280.0
|
||||
offset_bottom = 720.0
|
||||
texture = ExtResource("2_6n1ip")
|
||||
|
||||
[node name="Game name" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 35.0
|
||||
offset_top = 3.0
|
||||
offset_right = 1235.0
|
||||
offset_bottom = 73.0
|
||||
theme_override_font_sizes/font_size = 40
|
||||
text = "BUTTON_ERASE"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Bottomhud" parent="." instance=ExtResource("3_72nl0")]
|
||||
layout_mode = 1
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -139.0
|
||||
offset_top = -395.0
|
||||
offset_right = 139.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
|
||||
[node name="Ram" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs")
|
||||
text = "Game Data in RAM"
|
||||
|
||||
[node name="Slot1" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs")
|
||||
text = "Slot 1"
|
||||
|
||||
[node name="Slot2" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs")
|
||||
text = "Slot 2"
|
||||
|
||||
[node name="Slot3" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs")
|
||||
text = "Slot 3"
|
||||
|
||||
[node name="Slot4" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs")
|
||||
text = "Slot 4"
|
||||
|
||||
[node name="Slot5" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs")
|
||||
text = "Slot 5"
|
||||
|
||||
[node name="Slot6" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs")
|
||||
text = "Slot 6"
|
||||
|
||||
[node name="Slot7" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs")
|
||||
text = "Slot 7"
|
||||
|
||||
[node name="Slot8" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs")
|
||||
text = "Slot 8"
|
||||
|
||||
[node name="Back" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_r2qrn")
|
||||
text = "BUTTON_RETURN"
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/Ram" to="." method="_on_ram_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot1" to="." method="_on_slot_1_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot2" to="." method="_on_slot_2_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot3" to="." method="_on_slot_3_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot4" to="." method="_on_slot_4_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot5" to="." method="_on_slot_5_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot6" to="." method="_on_slot_6_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot7" to="." method="_on_slot_7_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot8" to="." method="_on_slot_8_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Back" to="." method="_on_back_pressed"]
|
89
levels/ui/load.gd
Normal file
89
levels/ui/load.gd
Normal file
|
@ -0,0 +1,89 @@
|
|||
extends Control
|
||||
const gamepadtest = preload("res://gamepad.gd")
|
||||
const loadgame = preload("res://load.gd")
|
||||
func _ready():
|
||||
#Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
|
||||
$VBoxContainer/Slot1.grab_focus()
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
func _level():
|
||||
# This is like autoloading the scene, only
|
||||
# it happens after already loading the main scene.
|
||||
get_tree().change_scene_to_file("res://backgounds/disclaimer.tscn")
|
||||
#Global.live = 1
|
||||
#Global.gamelevel = randi() % 3
|
||||
#if Global.gamelevel == 0:
|
||||
# get_tree().change_scene_to_file("res://backgounds/galaxy.tscn")
|
||||
#elif Global.gamelevel == 1:
|
||||
# get_tree().change_scene_to_file("res://backgounds/wormhole.tscn")
|
||||
#else:
|
||||
# get_tree().change_scene_to_file("res://backgounds/abstract.tscn")
|
||||
#get_tree().root.add_child(title)
|
||||
#get_tree().root.remove_child(boot)
|
||||
#boot.queue_free()
|
||||
|
||||
func _input(event):
|
||||
gamepadtest.new(event)
|
||||
# Mouse in viewport coordinates.
|
||||
if Input.is_action_just_pressed("ui_cancel"):
|
||||
_on_back_pressed()
|
||||
#print("Mouse Click/Unclick at: ", event.position)
|
||||
# if highlighted == 1:
|
||||
# _on_debug_pressed()
|
||||
# if highlighted == 2:
|
||||
# _on_exit_pressed()
|
||||
# else:
|
||||
# _on_start_pressed()
|
||||
# elif Input.is_action_pressed("ui_up"):
|
||||
# focus_next
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_back_pressed():
|
||||
get_tree().change_scene_to_file("res://levels/ui/savefile.tscn")
|
||||
|
||||
func _on_slot_1_pressed() -> void:
|
||||
loadgame.new(1)
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_2_pressed() -> void:
|
||||
loadgame.new(2)
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_3_pressed() -> void:
|
||||
loadgame.new(3)
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_4_pressed() -> void:
|
||||
loadgame.new(4)
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_5_pressed() -> void:
|
||||
loadgame.new(5)
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_6_pressed() -> void:
|
||||
loadgame.new(6)
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_7_pressed() -> void:
|
||||
loadgame.new(7)
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_8_pressed() -> void:
|
||||
loadgame.new(8)
|
||||
_on_back_pressed()
|
116
levels/ui/load.tscn
Normal file
116
levels/ui/load.tscn
Normal file
|
@ -0,0 +1,116 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://d0snuhuxkpvba"]
|
||||
|
||||
[ext_resource type="Script" path="res://levels/ui/load.gd" id="1_jemxw"]
|
||||
[ext_resource type="Texture2D" uid="uid://bxa27c7gnivwx" path="res://backgounds/night-sky-at-ceres.jpg" id="2_y0r7s"]
|
||||
[ext_resource type="PackedScene" uid="uid://d31udhuuwrajn" path="res://levels/bottomhud.tscn" id="3_ldlpj"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_anfrg"]
|
||||
bg_color = Color(0, 0.8, 0, 1)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_r2qrn"]
|
||||
bg_color = Color(0, 0.8, 0, 1)
|
||||
|
||||
[node name="Load" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_jemxw")
|
||||
|
||||
[node name="Night Sky" type="TextureRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_right = 1280.0
|
||||
offset_bottom = 720.0
|
||||
texture = ExtResource("2_y0r7s")
|
||||
|
||||
[node name="Game name" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 35.0
|
||||
offset_top = 3.0
|
||||
offset_right = 1235.0
|
||||
offset_bottom = 73.0
|
||||
theme_override_font_sizes/font_size = 40
|
||||
text = "BUTTON_LOAD"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Bottomhud" parent="." instance=ExtResource("3_ldlpj")]
|
||||
layout_mode = 1
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -139.0
|
||||
offset_top = -395.0
|
||||
offset_right = 139.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
|
||||
[node name="Slot1" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_anfrg")
|
||||
text = "Slot 1"
|
||||
|
||||
[node name="Slot2" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_anfrg")
|
||||
text = "Slot 2"
|
||||
|
||||
[node name="Slot3" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_anfrg")
|
||||
text = "Slot 3"
|
||||
|
||||
[node name="Slot4" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_anfrg")
|
||||
text = "Slot 4"
|
||||
|
||||
[node name="Slot5" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_anfrg")
|
||||
text = "Slot 5"
|
||||
|
||||
[node name="Slot6" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_anfrg")
|
||||
text = "Slot 6"
|
||||
|
||||
[node name="Slot7" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_anfrg")
|
||||
text = "Slot 7"
|
||||
|
||||
[node name="Slot8" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_anfrg")
|
||||
text = "Slot 8"
|
||||
|
||||
[node name="Back" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_r2qrn")
|
||||
text = "BUTTON_RETURN"
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/Slot1" to="." method="_on_slot_1_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot2" to="." method="_on_slot_2_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot3" to="." method="_on_slot_3_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot4" to="." method="_on_slot_4_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot5" to="." method="_on_slot_5_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot6" to="." method="_on_slot_6_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot7" to="." method="_on_slot_7_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot8" to="." method="_on_slot_8_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Back" to="." method="_on_back_pressed"]
|
89
levels/ui/save.gd
Normal file
89
levels/ui/save.gd
Normal file
|
@ -0,0 +1,89 @@
|
|||
extends Control
|
||||
const gamepadtest = preload("res://gamepad.gd")
|
||||
const savegame = preload("res://save.gd")
|
||||
func _ready():
|
||||
#Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
|
||||
$VBoxContainer/Slot1.grab_focus()
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
func _level():
|
||||
# This is like autoloading the scene, only
|
||||
# it happens after already loading the main scene.
|
||||
get_tree().change_scene_to_file("res://backgounds/disclaimer.tscn")
|
||||
#Global.live = 1
|
||||
#Global.gamelevel = randi() % 3
|
||||
#if Global.gamelevel == 0:
|
||||
# get_tree().change_scene_to_file("res://backgounds/galaxy.tscn")
|
||||
#elif Global.gamelevel == 1:
|
||||
# get_tree().change_scene_to_file("res://backgounds/wormhole.tscn")
|
||||
#else:
|
||||
# get_tree().change_scene_to_file("res://backgounds/abstract.tscn")
|
||||
#get_tree().root.add_child(title)
|
||||
#get_tree().root.remove_child(boot)
|
||||
#boot.queue_free()
|
||||
|
||||
func _input(event):
|
||||
gamepadtest.new(event)
|
||||
# Mouse in viewport coordinates.
|
||||
if Input.is_action_just_pressed("ui_cancel"):
|
||||
_on_back_pressed()
|
||||
#print("Mouse Click/Unclick at: ", event.position)
|
||||
# if highlighted == 1:
|
||||
# _on_debug_pressed()
|
||||
# if highlighted == 2:
|
||||
# _on_exit_pressed()
|
||||
# else:
|
||||
# _on_start_pressed()
|
||||
# elif Input.is_action_pressed("ui_up"):
|
||||
# focus_next
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_back_pressed():
|
||||
get_tree().change_scene_to_file("res://levels/ui/savefile.tscn")
|
||||
|
||||
func _on_slot_1_pressed() -> void:
|
||||
savegame.new(1, false)
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_2_pressed() -> void:
|
||||
savegame.new(2, false)
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_3_pressed() -> void:
|
||||
savegame.new(3, false)
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_4_pressed() -> void:
|
||||
savegame.new(4, false)
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_5_pressed() -> void:
|
||||
savegame.new(5, false)
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_6_pressed() -> void:
|
||||
savegame.new(6, false)
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_7_pressed() -> void:
|
||||
savegame.new(7, false)
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func _on_slot_8_pressed() -> void:
|
||||
savegame.new(8, false)
|
||||
_on_back_pressed()
|
116
levels/ui/save.tscn
Normal file
116
levels/ui/save.tscn
Normal file
|
@ -0,0 +1,116 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://bbohrt1bhjiac"]
|
||||
|
||||
[ext_resource type="Script" path="res://levels/ui/save.gd" id="1_qm2cb"]
|
||||
[ext_resource type="Texture2D" uid="uid://bxa27c7gnivwx" path="res://backgounds/night-sky-at-ceres.jpg" id="2_r4a1h"]
|
||||
[ext_resource type="PackedScene" uid="uid://d31udhuuwrajn" path="res://levels/bottomhud.tscn" id="3_waqiq"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_lcmit"]
|
||||
bg_color = Color(0, 0.8, 0, 1)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_r2qrn"]
|
||||
bg_color = Color(0, 0.8, 0, 1)
|
||||
|
||||
[node name="Save" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_qm2cb")
|
||||
|
||||
[node name="Night Sky" type="TextureRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_right = 1280.0
|
||||
offset_bottom = 720.0
|
||||
texture = ExtResource("2_r4a1h")
|
||||
|
||||
[node name="Game name" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 35.0
|
||||
offset_top = 3.0
|
||||
offset_right = 1235.0
|
||||
offset_bottom = 73.0
|
||||
theme_override_font_sizes/font_size = 40
|
||||
text = "BUTTON_SAVE"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Bottomhud" parent="." instance=ExtResource("3_waqiq")]
|
||||
layout_mode = 1
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -139.0
|
||||
offset_top = -395.0
|
||||
offset_right = 139.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
|
||||
[node name="Slot1" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_lcmit")
|
||||
text = "Slot 1"
|
||||
|
||||
[node name="Slot2" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_lcmit")
|
||||
text = "Slot 2"
|
||||
|
||||
[node name="Slot3" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_lcmit")
|
||||
text = "Slot 3"
|
||||
|
||||
[node name="Slot4" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_lcmit")
|
||||
text = "Slot 4"
|
||||
|
||||
[node name="Slot5" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_lcmit")
|
||||
text = "Slot 5"
|
||||
|
||||
[node name="Slot6" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_lcmit")
|
||||
text = "Slot 6"
|
||||
|
||||
[node name="Slot7" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_lcmit")
|
||||
text = "Slot 7"
|
||||
|
||||
[node name="Slot8" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_lcmit")
|
||||
text = "Slot 8"
|
||||
|
||||
[node name="Back" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_r2qrn")
|
||||
text = "BUTTON_RETURN"
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/Slot1" to="." method="_on_slot_1_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot2" to="." method="_on_slot_2_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot3" to="." method="_on_slot_3_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot4" to="." method="_on_slot_4_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot5" to="." method="_on_slot_5_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot6" to="." method="_on_slot_6_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot7" to="." method="_on_slot_7_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Slot8" to="." method="_on_slot_8_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Back" to="." method="_on_back_pressed"]
|
|
@ -29,7 +29,7 @@ func _level():
|
|||
func _input(event):
|
||||
gamepadtest.new(event)
|
||||
if Input.is_action_just_pressed("ui_cancel"):
|
||||
get_tree().change_scene_to_file("res://levels/ui/tmenu.tscn")
|
||||
_on_back_pressed()
|
||||
# Mouse in viewport coordinates.
|
||||
# if Input.is_key_pressed(KEY_ENTER) || Input.is_joy_button_pressed(0,JOY_BUTTON_B):
|
||||
# print("Mouse Click/Unclick at: ", event.position)
|
||||
|
@ -45,12 +45,16 @@ func _input(event):
|
|||
|
||||
|
||||
func _on_load_pressed() -> void:
|
||||
pass # Replace with function body.
|
||||
get_tree().change_scene_to_file("res://levels/ui/load.tscn")
|
||||
|
||||
|
||||
func _on_save_pressed() -> void:
|
||||
pass # Replace with function body.
|
||||
get_tree().change_scene_to_file("res://levels/ui/save.tscn")
|
||||
|
||||
|
||||
func _on_erase_pressed() -> void:
|
||||
Global.dificulty = 0
|
||||
get_tree().change_scene_to_file("res://levels/ui/erase.tscn")
|
||||
|
||||
|
||||
func _on_back_pressed() -> void:
|
||||
get_tree().change_scene_to_file("res://levels/ui/settings.tscn")
|
||||
|
|
|
@ -31,9 +31,9 @@ texture = ExtResource("2_nirgk")
|
|||
[node name="Game name" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 31.0
|
||||
offset_top = 113.0
|
||||
offset_top = 77.0
|
||||
offset_right = 1237.0
|
||||
offset_bottom = 243.0
|
||||
offset_bottom = 207.0
|
||||
theme_override_font_sizes/font_size = 95
|
||||
text = "BUTTON_PERSISTENCE"
|
||||
horizontal_alignment = 1
|
||||
|
@ -72,6 +72,13 @@ theme_override_font_sizes/font_size = 80
|
|||
theme_override_styles/focus = SubResource("StyleBoxFlat_r2qrn")
|
||||
text = "BUTTON_ERASE"
|
||||
|
||||
[node name="Back" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 80
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_r2qrn")
|
||||
text = "BUTTON_RETURN"
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/Load" to="." method="_on_load_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Save" to="." method="_on_save_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Erase" to="." method="_on_erase_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Back" to="." method="_on_back_pressed"]
|
||||
|
|
|
@ -88,4 +88,4 @@ func _on_dialogtest_pressed() -> void:
|
|||
|
||||
|
||||
func _on_bullethell_pressed() -> void:
|
||||
pass
|
||||
get_tree().change_scene_to_file("res://levels/ui/savefile.tscn")
|
||||
|
|
|
@ -73,7 +73,7 @@ text = "BUTTON_DEBUG"
|
|||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs")
|
||||
text = "BUTTON_PLACEHOLDER"
|
||||
text = "BUTTON_PERSISTENCE"
|
||||
|
||||
[node name="Credits" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
|
|
@ -61,8 +61,4 @@ func _on_debug_pressed():
|
|||
|
||||
func _on_exit_pressed():
|
||||
get_tree().quit()
|
||||
#pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_savefile_pressed() -> void:
|
||||
get_tree().change_scene_to_file("res://levels/ui/savefile.tscn")
|
||||
#pass # Replace with functio
|
||||
|
|
|
@ -66,12 +66,6 @@ theme_override_font_sizes/font_size = 80
|
|||
theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs")
|
||||
text = "BUTTON_SETTINGS"
|
||||
|
||||
[node name="Savefile" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 80
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs")
|
||||
text = "BUTTON_PERSISTENCE"
|
||||
|
||||
[node name="Exit" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 80
|
||||
|
@ -80,5 +74,4 @@ text = "BUTTON_EXIT"
|
|||
|
||||
[connection signal="pressed" from="VBoxContainer/Start" to="." method="_on_start_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Debug" to="." method="_on_debug_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Savefile" to="." method="_on_savefile_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Exit" to="." method="_on_exit_pressed"]
|
||||
|
|
110
load.gd
110
load.gd
|
@ -1,10 +1,79 @@
|
|||
extends Node
|
||||
var file
|
||||
func _init():
|
||||
if FileAccess.file_exists(Global.hiscoresfile):
|
||||
Global.firstrun = false
|
||||
file = FileAccess.open(Global.hiscoresfile, FileAccess.READ)
|
||||
Global.levelmax = file.get_as_text().rsplit(",", true, 7)
|
||||
var fileslot
|
||||
func _init(slot):
|
||||
if FileAccess.file_exists("user://userprefs"):
|
||||
|
||||
|
||||
file = FileAccess.open("user://userprefs", FileAccess.READ)
|
||||
var savefile = file.get_as_text().rsplit(",", true, 7)
|
||||
file.close()
|
||||
DisplayServer.window_set_vsync_mode(int(savefile[1]))
|
||||
DisplayServer.window_set_mode(int(savefile[2]))
|
||||
if slot == 0:
|
||||
fileslot = int(savefile[0])
|
||||
else:
|
||||
fileslot = slot
|
||||
if fileslot == 1:
|
||||
file = FileAccess.open("user://slot1", FileAccess.READ)
|
||||
savefile = file.get_as_text().rsplit("\n", true, 7)
|
||||
file.close()
|
||||
elif fileslot == 2:
|
||||
file = FileAccess.open("user://slot2", FileAccess.READ)
|
||||
savefile = file.get_as_text().rsplit("\n", true, 7)
|
||||
file.close()
|
||||
elif fileslot == 3:
|
||||
file = FileAccess.open("user://slot3", FileAccess.READ)
|
||||
savefile = file.get_as_text().rsplit("\n", true, 7)
|
||||
file.close()
|
||||
elif fileslot == 4:
|
||||
file = FileAccess.open("user://slot4", FileAccess.READ)
|
||||
savefile = file.get_as_text().rsplit("\n", true, 7)
|
||||
file.close()
|
||||
elif fileslot == 5:
|
||||
file = FileAccess.open("user://slot5", FileAccess.READ)
|
||||
savefile = file.get_as_text().rsplit("\n", true, 7)
|
||||
file.close()
|
||||
elif fileslot == 6:
|
||||
file = FileAccess.open("user://slot6", FileAccess.READ)
|
||||
savefile = file.get_as_text().rsplit("\n", true, 7)
|
||||
file.close()
|
||||
elif fileslot == 7:
|
||||
file = FileAccess.open("user://slot7", FileAccess.READ)
|
||||
savefile = file.get_as_text().rsplit("\n", true, 7)
|
||||
file.close()
|
||||
elif fileslot == 8:
|
||||
file = FileAccess.open("user://slot8", FileAccess.READ)
|
||||
savefile = file.get_as_text().rsplit("\n", true, 7)
|
||||
file.close()
|
||||
if fileslot != 0:
|
||||
Global.dificulty = int(savefile[2])
|
||||
var quest = savefile[4].rsplit(",", true, 7)
|
||||
Global.quest = [int(quest[0]), int(quest[1]), int(quest[2]), int(quest[3]), int(quest[4]), int(quest[5])]
|
||||
quest = savefile[3].rsplit(",", true, 7)
|
||||
Global.cplace = [int(quest[0]), int(quest[1]), int(quest[2])]
|
||||
Global.cpchar = int(savefile[1])
|
||||
quest = savefile[0].rsplit(",", true, 9)
|
||||
Global.party[0][0] = int(quest[0])
|
||||
Global.party[0][1] = int(quest[1])
|
||||
if quest[2].is_valid_int():
|
||||
Global.party[1][0] = int(quest[2])
|
||||
Global.party[1][1] = int(quest[3])
|
||||
else:
|
||||
Global.party[1][0] = null
|
||||
Global.party[1][1] = null
|
||||
if quest[4].is_valid_int():
|
||||
Global.party[2][0] = int(quest[4])
|
||||
Global.party[2][1] = int(quest[5])
|
||||
else:
|
||||
Global.party[2][0] = null
|
||||
Global.party[2][1] = null
|
||||
if quest[6].is_valid_int():
|
||||
Global.party[3][0] = int(quest[6])
|
||||
Global.party[3][1] = int(quest[7])
|
||||
else:
|
||||
Global.party[3][0] = null
|
||||
Global.party[3][1] = null
|
||||
# We need to revert the game state so we're not cloning objects
|
||||
# during loading. This will vary wildly depending on the needs of a
|
||||
# project, so take care with this step.
|
||||
|
@ -17,7 +86,32 @@ func _init():
|
|||
# the object it represents.
|
||||
else:
|
||||
#Global.firstrun = true
|
||||
var saveinit = "9999999,9999999,9999999,9999999,9999999,9999999,9999999"
|
||||
var file = FileAccess.open(Global.hiscoresfile, FileAccess.WRITE)
|
||||
var saveinit = "0,1,3"
|
||||
var file = FileAccess.open("user://userprefs", FileAccess.WRITE)
|
||||
file.store_string(saveinit)
|
||||
Global.levelmax = saveinit.rsplit(",", true, 7)
|
||||
file.close()
|
||||
saveinit = "0,0,<null>,<null>,<null>,<null>,<null>,<null>\n0\n0\n1,11,19\n0,0,0,0,0,0"
|
||||
file = FileAccess.open("user://slot1", FileAccess.WRITE)
|
||||
file.store_string(saveinit)
|
||||
file.close()
|
||||
file = FileAccess.open("user://slot2", FileAccess.WRITE)
|
||||
file.store_string(saveinit)
|
||||
file.close()
|
||||
file = FileAccess.open("user://slot3", FileAccess.WRITE)
|
||||
file.store_string(saveinit)
|
||||
file.close()
|
||||
file = FileAccess.open("user://slot4", FileAccess.WRITE)
|
||||
file.store_string(saveinit)
|
||||
file.close()
|
||||
file = FileAccess.open("user://slot5", FileAccess.WRITE)
|
||||
file.store_string(saveinit)
|
||||
file.close()
|
||||
file = FileAccess.open("user://slot6", FileAccess.WRITE)
|
||||
file.store_string(saveinit)
|
||||
file.close()
|
||||
file = FileAccess.open("user://slot7", FileAccess.WRITE)
|
||||
file.store_string(saveinit)
|
||||
file.close()
|
||||
file = FileAccess.open("user://slot8", FileAccess.WRITE)
|
||||
file.store_string(saveinit)
|
||||
file.close()
|
||||
|
|
2
main.gd
2
main.gd
|
@ -12,7 +12,7 @@ func _ready():
|
|||
updatehud()
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
|
||||
#OS.get_data_dir().rsplit("/", true, 7)[2]
|
||||
#loadgame.new()
|
||||
loadgame.new(0)
|
||||
#print(OS.get_processor_name())
|
||||
#pass # Replace with function body.
|
||||
#add_child(title)
|
||||
|
|
42
save.gd
42
save.gd
|
@ -1,6 +1,42 @@
|
|||
extends Node
|
||||
func _init():
|
||||
var saveinit = Global.levelmax[0]+","+Global.levelmax[1]+","+Global.levelmax[2]+","+Global.levelmax[3]+","+Global.levelmax[4]+","+Global.levelmax[5]+","+Global.levelmax[6]
|
||||
var file = FileAccess.open(Global.hiscoresfile, FileAccess.WRITE)
|
||||
func _init(slot, erase):
|
||||
var saveinit = str(slot)+","+str(DisplayServer.window_get_vsync_mode())+","+str(DisplayServer.window_get_mode())
|
||||
var file = FileAccess.open("user://userprefs", FileAccess.WRITE)
|
||||
file.store_string(saveinit)
|
||||
file.close()
|
||||
if erase:
|
||||
saveinit = "0,0,<null>,<null>,<null>,<null>,<null>,<null>\n0\n0\n1,11,19\n0,0,0,0,0,0"
|
||||
else:
|
||||
saveinit = str(Global.party[0][0])+","+str(Global.party[0][1])+","+str(Global.party[1][0])+","+str(Global.party[1][1])+","+str(Global.party[2][0])+","+str(Global.party[2][1])+","+str(Global.party[3][0])+","+str(Global.party[3][1])+"\n"+str(Global.cpchar)+"\n"+str(Global.dificulty)+"\n"+str(Global.cplace[0])+","+str(Global.cplace[1])+","+str(Global.cplace[2])+"\n"+str(Global.quest[0])+","+str(Global.quest[1])+","+str(Global.quest[2])+","+str(Global.quest[3])+","+str(Global.quest[4])+","+str(Global.quest[5])
|
||||
if slot == 1:
|
||||
file = FileAccess.open("user://slot1", FileAccess.WRITE)
|
||||
file.store_string(saveinit)
|
||||
file.close()
|
||||
elif slot == 2:
|
||||
file = FileAccess.open("user://slot2", FileAccess.WRITE)
|
||||
file.store_string(saveinit)
|
||||
file.close()
|
||||
elif slot == 3:
|
||||
file = FileAccess.open("user://slot3", FileAccess.WRITE)
|
||||
file.store_string(saveinit)
|
||||
file.close()
|
||||
elif slot == 4:
|
||||
file = FileAccess.open("user://slot4", FileAccess.WRITE)
|
||||
file.store_string(saveinit)
|
||||
file.close()
|
||||
elif slot == 5:
|
||||
file = FileAccess.open("user://slot5", FileAccess.WRITE)
|
||||
file.store_string(saveinit)
|
||||
file.close()
|
||||
elif slot == 6:
|
||||
file = FileAccess.open("user://slot6", FileAccess.WRITE)
|
||||
file.store_string(saveinit)
|
||||
file.close()
|
||||
elif slot == 7:
|
||||
file = FileAccess.open("user://slot7", FileAccess.WRITE)
|
||||
file.store_string(saveinit)
|
||||
file.close()
|
||||
elif slot == 8:
|
||||
file = FileAccess.open("user://slot8", FileAccess.WRITE)
|
||||
file.store_string(saveinit)
|
||||
file.close()
|
||||
|
|
1
title.gd
1
title.gd
|
@ -16,7 +16,6 @@ func _ready():
|
|||
#Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
|
||||
#if (OS.get_name() != "Linux" && !OS.get_name().ends_with("BSD")) || OS.get_distribution_name().contains("Kali") || !OS.get_data_dir().begins_with("/home") || OS.get_environment("WSL_DISTRO_NAME").length() < 0:
|
||||
# Global.sk = true
|
||||
Global.gamelevel = null
|
||||
add_child(bgsound)
|
||||
var titlemusic = load(Global.musictracks[0])
|
||||
bgsound.stream = titlemusic
|
||||
|
|
Loading…
Reference in a new issue