Skip to content

Commit

Permalink
bugfix v0.4
Browse files Browse the repository at this point in the history
Fixed a bug where the absolute path for the image and save was not corresponding to the actual path
  • Loading branch information
TroncoNinja committed Apr 17, 2024
1 parent edff44e commit d4e5040
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,4 @@ Anim={
"zfar": 4000.01,
"znear": 0.05
}
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Control/TabContainer/Inventario/HBoxContainer/PanelContainer/VBoxContainer/GadgetSelected")])
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Control/TabContainer/Inventario/HBoxContainer/VBoxContainer/Weapon2/PanelContainer/MainWeapon")])

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .godot/editor/create_recent.Node
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
HTTPRequest
MarginContainer
SpinBox
Label
GridContainer
Expand All @@ -11,5 +13,3 @@ HSeparator
ColorRect
Button
MenuButton
MenuBar
NinePatchRect
8 changes: 4 additions & 4 deletions .godot/editor/editor_layout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dock_filesystem_split=0
dock_filesystem_display_mode=0
dock_filesystem_file_sort=0
dock_filesystem_file_list_display_mode=1
dock_filesystem_selected_paths=PackedStringArray("res://README.md")
dock_filesystem_selected_paths=PackedStringArray("res://save/")
dock_filesystem_uncollapsed_paths=PackedStringArray("Favorites", "res://", "res://save/", "res://gadgets/")
dock_3="Scene,Import"
dock_4="FileSystem"
Expand All @@ -36,9 +36,9 @@ selected_main_editor_idx=2

[ScriptEditor]

open_scripts=["res://MainWeapon.gd", "res://save/personaggio.json", "res://README.md", "res://save_load.gd"]
selected_script="res://README.md"
open_help=["Button", "FileAccess", "Image", "JSON", "Node", "Object", "OptionButton", "Signal"]
open_scripts=["res://MainWeapon.gd", "res://README.md", "res://save_load.gd"]
selected_script="res://save_load.gd"
open_help=["ResourceLoader"]
script_split_offset=70
list_split_offset=0

Expand Down
19 changes: 10 additions & 9 deletions .godot/editor/filesystem_cache8
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
fc8a56933c4b1c8d796fdb8f7a9f9475
::res://::1713105889
control.tscn::PackedScene::3967560098168932687::1713033366::0::1::::<><>::uid://b72vtrk6dlb2p::::res://icons/iconaPg.svg<>uid://dxavjiunljyv6::::res://temi/tema_bottoni.tres<>uid://wqtgjxfpupi3::::res://icons/armor.svg<>uid://dijl332ttrhwv::::res://icons/hp_base.svg<>uid://yy4yyd1ke26p::::res://icons/armor_selected.svg<>uid://do7wgix1nuvft::::res://icons/hp_hit.svg<>uid://c730rud8k6j2l::::res://weapons/weapon_ak.svg<>res://MainWeapon.gd<>uid://3q31v11i0kde::::res://gadgets/perk_di.svg
export_presets.cfg::TextFile::-1::1713033586::0::1::::<><>::
::res://::1713381619
control.tscn::PackedScene::3967560098168932687::1713381618::0::1::::<><>::uid://b72vtrk6dlb2p::::res://icons/iconaPg.svg<>res://save_load.gd<>uid://dxavjiunljyv6::::res://temi/tema_bottoni.tres<>uid://wqtgjxfpupi3::::res://icons/armor.svg<>uid://dijl332ttrhwv::::res://icons/hp_base.svg<>uid://yy4yyd1ke26p::::res://icons/armor_selected.svg<>uid://do7wgix1nuvft::::res://icons/hp_hit.svg<>uid://c730rud8k6j2l::::res://weapons/weapon_ak.svg<>res://MainWeapon.gd<>uid://3q31v11i0kde::::res://gadgets/perk_di.svg
export_presets.cfg::TextFile::-1::1713120247::0::1::::<><>::
icon.svg::CompressedTexture2D::8999567548390004678::1712083807::1712083813::1::::<><>::
MainWeapon.gd::GDScript::-1::1712751707::0::1::::<>TextureRect<>::
personaggio.png::CompressedTexture2D::3132143129065055400::1712094052::1712094092::1::::<><>::
README.md::TextFile::-1::1713033758::0::1::::<><>::
README.md::TextFile::-1::1713120640::0::1::::<><>::
save_load.gd::GDScript::-1::1713381618::0::1::::<>Control<>::
::res://gadgets/::1713029441
perk_di.svg::CompressedTexture2D::2000065316717125274::1713029254::1713029441::1::::<><>::
perk_optic.svg::CompressedTexture2D::1308075419859058488::1713027024::1713029441::1::::<><>::
Expand All @@ -18,10 +18,11 @@ armor_selected.svg::CompressedTexture2D::1735882231643847385::1712168966::171216
hp_base.svg::CompressedTexture2D::7740071602372732149::1712235690::1712236650::1::::<><>::
hp_hit.svg::CompressedTexture2D::8209312895662767617::1712235722::1712236650::1::::<><>::
iconaPg.svg::CompressedTexture2D::4689511776159978257::1712088924::1712090174::1::::<><>::
::res://save/::1712752161
personaggio.png::CompressedTexture2D::2578078441298005491::1712752224::1712752161::1::::<><>::
::res://temi/::1713022593
tema_bottoni.tres::Theme::8774897035435919713::1713022593::0::1::::<><>::
::res://save/::1713381639
personaggio.json::JSON::-1::1713381639::0::1::::<><>::
personaggio.png::CompressedTexture2D::3069646437652423147::1713381632::1713381640::1::::<><>::
::res://temi/::1713375696
tema_bottoni.tres::Theme::8774897035435919713::1713375696::0::1::::<><>::
::res://weapons/::1712745831
weapon_ak.svg::CompressedTexture2D::7078236280847835197::1712745831::1712745831::1::::<><>::
weapon_ar.svg::CompressedTexture2D::7053769743073270852::1712745831::1712745831::1::::<><>::
Expand Down
2 changes: 0 additions & 2 deletions .godot/editor/filesystem_update4
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
res://control.tscn
res://temi/tema_bottoni.tres
res://save_load.gd
res://save/personaggio.json
res://README.md
2 changes: 1 addition & 1 deletion .godot/editor/project_metadata.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ last_selected_language="GDScript"

[recent_files]

scripts=["res://README.md", "Signal", "res://control.tscn::GDScript_g7rjf", "OptionButton", "Object", "Node", "FileAccess", "res://save/personaggio.json", "res://save_load.gd", "JSON"]
scripts=["ResourceLoader", "res://control.tscn::GDScript_yhbxl", "res://control.tscn::GDScript_fdhxj", "res://control.tscn::GDScript_8grla", "Signal", "OptionButton", "Object", "Node", "JSON", "Image"]
scenes=["res://control.tscn"]

[color_picker]
Expand Down
6 changes: 3 additions & 3 deletions .godot/editor/script_editor_cache.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ state={
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 61,
"column": 29,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 144,
"scroll_position": 144.0,
"row": 119,
"scroll_position": 107.0,
"selection": false,
"syntax_highlighter": "GDScript"
}
Expand Down
4 changes: 2 additions & 2 deletions .godot/exported/133200997/file_cache
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
res://control.tscn::c8bfbf2a66a23b3965c902ad9461f436::1713120168::res://.godot/exported/133200997/export-e66311c87c39ec8c25379305b5ae724b-control.scn
res://temi/tema_bottoni.tres::d11b61092f9b427c263d6c357231d76e::1713105961::res://.godot/exported/133200997/export-ee1a956fa5a7a6116498b9f095570d05-tema_bottoni.res
res://control.tscn::c8bfbf2a66a23b3965c902ad9461f436::1713381759::res://.godot/exported/133200997/export-e66311c87c39ec8c25379305b5ae724b-control.scn
res://temi/tema_bottoni.tres::d11b61092f9b427c263d6c357231d76e::1713375696::res://.godot/exported/133200997/export-ee1a956fa5a7a6116498b9f095570d05-tema_bottoni.res
Binary file not shown.
Binary file modified .godot/uid_cache.bin
Binary file not shown.
Binary file removed personaggio.png
Binary file not shown.
34 changes: 0 additions & 34 deletions personaggio.png.import

This file was deleted.

1 change: 0 additions & 1 deletion save/personaggio.json

This file was deleted.

Binary file removed save/personaggio.png
Binary file not shown.
34 changes: 0 additions & 34 deletions save/personaggio.png.import

This file was deleted.

12 changes: 9 additions & 3 deletions save_load.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
extends Control

func _ready():
var dir = DirAccess.open(OS.get_executable_path().get_base_dir());
dir.make_dir_absolute("save");

func _on_save_btn_pressed():
var dir = DirAccess.open(OS.get_executable_path().get_base_dir());
dir.make_dir("/save");
var dati = {
"numero" : %Codice.text,
"nome" : %Nome.text,
Expand Down Expand Up @@ -92,7 +97,7 @@ func _on_save_btn_pressed():
"gadget" : %GadgetSelected.selected
};
var json_dati = JSON.stringify(dati);
var file_access = FileAccess.open("save/personaggio.json", FileAccess.WRITE);
var file_access = FileAccess.open(OS.get_executable_path().get_base_dir() + "/save/personaggio.json", FileAccess.WRITE);
if not file_access:
print("An error happened while saving data: ", FileAccess.get_open_error());
return
Expand All @@ -102,15 +107,16 @@ func _on_save_btn_pressed():

func _on_load_btn_pressed():
var json = JSON.new();
var file_access = FileAccess.open("save/personaggio.json", FileAccess.READ);
var file_access = FileAccess.open(OS.get_executable_path().get_base_dir() + "/save/personaggio.json", FileAccess.READ);
var error = json.parse(file_access.get_line());
if error == OK:
var dati = json.data;

%Codice.text = dati.numero;
%Nome.text = dati.nome;
%Cognome.text = dati.cognome;
%ImgPg.texture = load("save/personaggio.png");
%ImgPg.texture = ImageTexture.create_from_image(Image.load_from_file(OS.get_executable_path().get_base_dir() + "/save/personaggio.png"));
print(OS.get_executable_path().get_base_dir() + "/save/personaggio.png");
%Storia.text = dati.storia;

%Head.button_pressed = dati.corpo.head;
Expand Down

0 comments on commit d4e5040

Please sign in to comment.