From a7b9199d387db8384c34db8d897026ed9fa2b50b Mon Sep 17 00:00:00 2001 From: Page Asgardius Date: Mon, 23 Sep 2024 17:27:17 -0700 Subject: [PATCH] quest --- global.gd | 1 + levels/ui/newgame.gd | 36 ++++++------------- levels/ui/savefile.gd | 56 ++++++++++++++++++++++++++++++ levels/ui/savefile.tscn | 77 +++++++++++++++++++++++++++++++++++++++++ levels/ui/tmenu.gd | 16 +++++++-- levels/ui/tmenu.tscn | 7 ++++ text.csv | 5 +++ 7 files changed, 170 insertions(+), 28 deletions(-) create mode 100644 levels/ui/savefile.gd create mode 100644 levels/ui/savefile.tscn diff --git a/global.gd b/global.gd index 51d1d17..948c027 100644 --- a/global.gd +++ b/global.gd @@ -53,6 +53,7 @@ var debug = false const release = "R0.1.11-alpha" var sk = false var gamepad = 0 +var quest = [0, 0, 0, 0, 0, 0] # Called when the node enters the scene tree for the first time. func _ready(): pass # Replace with function body. diff --git a/levels/ui/newgame.gd b/levels/ui/newgame.gd index 52b499b..80a45c7 100644 --- a/levels/ui/newgame.gd +++ b/levels/ui/newgame.gd @@ -8,22 +8,6 @@ func _ready(): 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/wip.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) if Input.is_action_just_pressed("ui_cancel"): @@ -50,11 +34,7 @@ func _on_exit_pressed(): func _on_noob_pressed(): _statrebase() Global.dificulty = 1 - Global.cplace = [1, 11, 19] - Global.live = 1 - Global.cpchar = 0 - Global.party = [[0,0], [null,null], [null,null], [null,null]] - Global.ccutscene = 0 + _reset() get_tree().change_scene_to_file("res://levels/ui/Cutscenes.tscn") #pass # Replace with function body. @@ -62,11 +42,7 @@ func _on_noob_pressed(): func _on_thisfirst_pressed(): _statrebase() Global.dificulty = 2 - Global.cplace = [1, 11, 19] - Global.live = 1 - Global.cpchar = 0 - Global.party = [[0,0], [null,null], [null,null], [null,null]] - Global.ccutscene = 0 + _reset() get_tree().change_scene_to_file("res://levels/ui/Cutscenes.tscn") #pass # Replace with function body. @@ -85,3 +61,11 @@ func _statrebase(): if Global.party[i][0] != null: for j in 7: Global.cstats[Global.party[i][0]][j] = Global.basestats[Global.party[i][0]][j] * Global.level[Global.dparty[i][0]] + +func _reset(): + Global.quest = [0, 0, 0, 0, 0, 0] + Global.cplace = [1, 11, 19] + Global.live = 1 + Global.cpchar = 0 + Global.party = [[0,0], [null,null], [null,null], [null,null]] + Global.ccutscene = 0 diff --git a/levels/ui/savefile.gd b/levels/ui/savefile.gd new file mode 100644 index 0000000..b8c6690 --- /dev/null +++ b/levels/ui/savefile.gd @@ -0,0 +1,56 @@ +extends Control +const gamepadtest = preload("res://gamepad.gd") +var startbutton +func _ready(): + startbutton = $VBoxContainer/Start + #Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN) + $VBoxContainer/Load.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/wip.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) + if Input.is_action_just_pressed("ui_cancel"): + get_tree().change_scene_to_file("res://levels/ui/tmenu.tscn") +# 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) +# 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_load_pressed() -> void: + pass # Replace with function body. + + +func _on_save_pressed() -> void: + pass # Replace with function body. + + +func _on_erase_pressed() -> void: + Global.dificulty = 0 diff --git a/levels/ui/savefile.tscn b/levels/ui/savefile.tscn new file mode 100644 index 0000000..abc2fbd --- /dev/null +++ b/levels/ui/savefile.tscn @@ -0,0 +1,77 @@ +[gd_scene load_steps=7 format=3 uid="uid://dxegyw736dnig"] + +[ext_resource type="Script" path="res://levels/ui/savefile.gd" id="1_6r0p0"] +[ext_resource type="Texture2D" uid="uid://bxa27c7gnivwx" path="res://backgounds/night-sky-at-ceres.jpg" id="2_nirgk"] +[ext_resource type="PackedScene" uid="uid://d31udhuuwrajn" path="res://levels/bottomhud.tscn" id="3_bpp6x"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_821nm"] +bg_color = Color(0, 0.8, 0, 1) + +[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="Savefile" 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_6r0p0") + +[node name="Night Sky" type="TextureRect" parent="."] +layout_mode = 0 +offset_right = 1280.0 +offset_bottom = 720.0 +texture = ExtResource("2_nirgk") + +[node name="Game name" type="Label" parent="."] +layout_mode = 0 +offset_left = 31.0 +offset_top = 113.0 +offset_right = 1237.0 +offset_bottom = 243.0 +theme_override_font_sizes/font_size = 95 +text = "BUTTON_PERSISTENCE" +horizontal_alignment = 1 + +[node name="Bottomhud" parent="." instance=ExtResource("3_bpp6x")] +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 = -322.0 +offset_top = -362.0 +offset_right = 322.0 +grow_horizontal = 2 +grow_vertical = 0 + +[node name="Load" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 80 +theme_override_styles/focus = SubResource("StyleBoxFlat_821nm") +text = "BUTTON_LOAD" + +[node name="Save" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 80 +theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs") +text = "BUTTON_SAVE" + +[node name="Erase" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 80 +theme_override_styles/focus = SubResource("StyleBoxFlat_r2qrn") +text = "BUTTON_ERASE" + +[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"] diff --git a/levels/ui/tmenu.gd b/levels/ui/tmenu.gd index a2ccbf3..9924a0a 100644 --- a/levels/ui/tmenu.gd +++ b/levels/ui/tmenu.gd @@ -1,8 +1,12 @@ extends Control const gamepadtest = preload("res://gamepad.gd") +var startbutton func _ready(): - Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN) + startbutton = $VBoxContainer/Start + #Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN) $VBoxContainer/Start.grab_focus() + if Global.dificulty != 0: + startbutton.set_text(tr("BUTTON_CONTINUE")) # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): @@ -42,7 +46,11 @@ func _input(event): func _on_start_pressed(): - get_tree().change_scene_to_file("res://levels/ui/newgame.tscn") + if Global.dificulty == 0: + get_tree().change_scene_to_file("res://levels/ui/newgame.tscn") + else: + Global.live = 1 + get_tree().change_scene_to_file("res://levels/ui/gameplay.tscn") #_level() #pass # Replace with function body. @@ -54,3 +62,7 @@ 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") diff --git a/levels/ui/tmenu.tscn b/levels/ui/tmenu.tscn index 446d62c..b8ac746 100644 --- a/levels/ui/tmenu.tscn +++ b/levels/ui/tmenu.tscn @@ -66,6 +66,12 @@ theme_override_font_sizes/font_size = 80 theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs") text = "BUTTON_DEBUG" +[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 @@ -74,4 +80,5 @@ 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"] diff --git a/text.csv b/text.csv index 5f7c04f..e729380 100644 --- a/text.csv +++ b/text.csv @@ -19,7 +19,12 @@ TEXT_EXIT_US;Press A to exit;Presiona A para salir;終了するにはAキーを TEXT_EXIT_GEO;Press X to exit;Presiona X para salir;終了するにはXキーを押してください GAME_NAME;Midori in the Magic School;Midori in the Magic School;改造魔法学校のミドリ BUTTON_START;Start;Iniciar;始める +BUTTON_CONTINUE;Continue;Continuar;続く BUTTON_DEBUG;Debug;Depurar;デバッグ +BUTTON_PERSISTENCE;Savefile;Guardado;保存ファイル +BUTTON_LOAD;Load;Cargar;ファイルを保存 +BUTTON_SAVE;Save;Guardar;ファイルを保存 +BUTTON_ERASE;Erase;Borrar;ファイルを保存 MENU_DEBUG;Debug Menu;Menú de Depuración;デバッグメニュー BUTTON_EXIT;Exit;Salir;このゲームを終了する START_NOOB;Coward;Cobarde;腰抜け