diff --git a/Phase2/Documentation/ToDoForCharacterMVP.txt b/Phase2/Documentation/ToDoForCharacterMVP.txt index f9a791c..7810e8e 100644 --- a/Phase2/Documentation/ToDoForCharacterMVP.txt +++ b/Phase2/Documentation/ToDoForCharacterMVP.txt @@ -9,3 +9,6 @@ 4: Then save the singleton data to a CSV 5: Figure out the issues with CSV like doug mentioned. + + + Completed: 3 diff --git a/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/Screens/Character_Add.gd b/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/Screens/Character_Add.gd index dd12d54..27aa6c9 100644 --- a/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/Screens/Character_Add.gd +++ b/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/Screens/Character_Add.gd @@ -7,23 +7,54 @@ extends Control onready var settings = get_node("/root/GlobalSaveInstance").settingsInstance onready var pSingleton = get_node("/root/PlayerCharacter").pc +onready var Name = get_node("Title/VBoxContainer/LabelName/LE_Name") + +onready var Profession = get_node("Title/VBoxContainer/LabelProfession/LE_Pro") + +onready var Strength = get_node("Title/VBoxContainer/LabelStrength/LE_Str") + +onready var Intellect = get_node("Title/VBoxContainer/LabelIntellect/LE_Intl") + +onready var Willpower = get_node("Title/VBoxContainer/LabelWillpower/LE_Will") + +onready var Charm = get_node("Title/VBoxContainer/LabelCharm/LE_Charm") + +onready var Weapon = get_node("Title/VBoxContainer/LabelWeapon/LE_Weapon") + +onready var Armor = get_node("Title/VBoxContainer/LabelArmor/LE_Armor") + +onready var Quote = get_node("Title/VBoxContainer/LabelQuote/LE_Quote") + func _ready() -> void: theme=load(settings.themeFile) $Title/But_SaveChar.grab_focus() +func _prep_PlayerCharacter_Template(): +# This function prepares the data for the player character in two ways. +# Way 1: By loading all of this data into the singleton for easy reads during gameplay +# Way 2: To prepare the data to be pulled from the singleton, when writing a file. + pSingleton.name = Name.text + pSingleton.profession = Profession.text + pSingleton.strength = Strength.text + pSingleton.intellect = Intellect.text + pSingleton.willpower = Willpower.text + pSingleton.charm = Charm.text + pSingleton.armor = Armor.text + pSingleton.quote = Quote.text + func _on_But_SaveChar_pressed() -> void: + _prep_PlayerCharacter_Template() $Title/FileDialog.popup() #DKM TEMP: this code was inherited and it needs pretty substantial # overhaul for use in the module, depending on toolset use. # For now all the labels are individual lineEdits we need to grab. func _on_FileDialog_file_selected(path: String) -> void: +# This function runs when you hit the button to save your file, after you selected the name and location +# TODO: Create the CSV File, Populate the CSV File, workout where it saves to. + var pc = get_node("/root/PlayerCharacter") var newCharFile = File.new() newCharFile.open(path, 2) - #DKM TEMP: getting something to work with as text - var newCharStr = $Title/VBoxContainer/LabelName/LE_Name.text - newCharFile.store_string(newCharStr) - pSingleton.pcText = "Name: " + newCharStr - print("PC text: " + pSingleton.pcText ) + diff --git a/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/Screens/Character_Add.tscn b/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/Screens/Character_Add.tscn index 631565a..0e4f0c9 100644 --- a/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/Screens/Character_Add.tscn +++ b/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/Screens/Character_Add.tscn @@ -88,7 +88,7 @@ margin_bottom = 66.0 text = "PROFESSION " -[node name="LineEdit" type="LineEdit" parent="Title/VBoxContainer/LabelProfession"] +[node name="LE_Pro" type="LineEdit" parent="Title/VBoxContainer/LabelProfession"] margin_top = 15.0 margin_right = 58.0 margin_bottom = 24.0 @@ -100,10 +100,10 @@ margin_bottom = 101.0 text = "STRENGTH " -[node name="LineEdit" type="LineEdit" parent="Title/VBoxContainer/LabelStrength"] +[node name="LE_Str" type="LineEdit" parent="Title/VBoxContainer/LabelStrength"] margin_top = 15.0 margin_right = 58.0 -margin_bottom = 24.0 +margin_bottom = 39.0 [node name="LabelIntellect" type="Label" parent="Title/VBoxContainer"] margin_top = 105.0 @@ -112,7 +112,7 @@ margin_bottom = 136.0 text = "INTELLECT " -[node name="LineEdit" type="LineEdit" parent="Title/VBoxContainer/LabelIntellect"] +[node name="LE_Intl" type="LineEdit" parent="Title/VBoxContainer/LabelIntellect"] margin_top = 15.0 margin_right = 58.0 margin_bottom = 24.0 @@ -124,7 +124,7 @@ margin_bottom = 171.0 text = "WILLPOWER " -[node name="LineEdit" type="LineEdit" parent="Title/VBoxContainer/LabelWillpower"] +[node name="LE_Will" type="LineEdit" parent="Title/VBoxContainer/LabelWillpower"] margin_top = 15.0 margin_right = 58.0 margin_bottom = 24.0 @@ -135,7 +135,7 @@ margin_right = 81.0 margin_bottom = 189.0 text = "CHARM" -[node name="LineEdit" type="LineEdit" parent="Title/VBoxContainer/LabelCharm"] +[node name="LE_Charm" type="LineEdit" parent="Title/VBoxContainer/LabelCharm"] margin_top = 15.0 margin_right = 58.0 margin_bottom = 24.0 @@ -147,7 +147,7 @@ margin_bottom = 224.0 text = "WEAPON " -[node name="LineEdit" type="LineEdit" parent="Title/VBoxContainer/LabelWeapon"] +[node name="LE_Weapon" type="LineEdit" parent="Title/VBoxContainer/LabelWeapon"] margin_top = 15.0 margin_right = 58.0 margin_bottom = 24.0 @@ -158,7 +158,7 @@ margin_right = 81.0 margin_bottom = 242.0 text = "ARMOR" -[node name="LineEdit" type="LineEdit" parent="Title/VBoxContainer/LabelArmor"] +[node name="LE_Armor" type="LineEdit" parent="Title/VBoxContainer/LabelArmor"] margin_top = 15.0 margin_right = 58.0 margin_bottom = 24.0 @@ -169,7 +169,7 @@ margin_right = 81.0 margin_bottom = 260.0 text = "QUOTE" -[node name="LineEdit" type="LineEdit" parent="Title/VBoxContainer/LabelQuote"] +[node name="LE_Quote" type="LineEdit" parent="Title/VBoxContainer/LabelQuote"] margin_top = 15.0 margin_right = 58.0 margin_bottom = 24.0 diff --git a/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/globalScripts/PlayerCharacter.gd b/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/globalScripts/PlayerCharacter.gd index 4abaece..d37fe93 100644 --- a/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/globalScripts/PlayerCharacter.gd +++ b/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/globalScripts/PlayerCharacter.gd @@ -1,11 +1,13 @@ #PLAYER CHARACTER: # Unique handler script for root PC singleton. May be adapted for -# player loading and saving functionality +# player loading and saving functionality. + +# Values are pulled from PlayerCharacterTemplate.gd extends Node -var pc +var pc func _ready() -> void: pc = playerCharacterTemplate.new() - + diff --git a/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/globalScripts/playerCharacterTemplate.gd b/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/globalScripts/playerCharacterTemplate.gd index a8665ce..b85996d 100644 --- a/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/globalScripts/playerCharacterTemplate.gd +++ b/Phase2/Godot_GameCode/_MVP_Game_Demo/Luke/bcirpg_game_mvp_2024_0204A/globalScripts/playerCharacterTemplate.gd @@ -6,3 +6,21 @@ extends Resource class_name playerCharacterTemplate var pcText = "" + +var name = "" + +var profession = "" + +var strength = "" + +var intellect = "" + +var willpower = "" + +var charm = "" + +var weapon = "" + +var armor = "" + +var quote = ""