Version: 0.0.1

First major release, refined the creator, added stats to the main game, added a menu to view stats.
This commit is contained in:
Patrick_Pluto 2024-06-15 20:33:37 +02:00
parent 8f78f8e5cb
commit e5911fd155
11 changed files with 264 additions and 42 deletions

62
export_presets.cfg Normal file
View file

@ -0,0 +1,62 @@
[preset.0]
name="Windows Desktop"
platform="Windows Desktop"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="../Desktop/debug"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
[preset.0.options]
custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=1
binary_format/embed_pck=false
texture_format/bptc=true
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
binary_format/architecture="x86_64"
codesign/enable=false
codesign/timestamp=true
codesign/timestamp_server_url=""
codesign/digest_algorithm=1
codesign/description=""
codesign/custom_options=PackedStringArray()
application/modify_resources=true
application/icon=""
application/console_wrapper_icon=""
application/icon_interpolation=4
application/file_version=""
application/product_version=""
application/company_name=""
application/product_name=""
application/file_description=""
application/copyright=""
application/trademarks=""
application/export_angle=0
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}'
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}'
$trigger = New-ScheduledTaskTrigger -Once -At 00:00
$settings = New-ScheduledTaskSettingsSet
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true
Start-ScheduledTask -TaskName godot_remote_debug
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 }
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue"
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
Remove-Item -Recurse -Force '{temp_dir}'"

View file

@ -44,6 +44,11 @@ down={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"echo":false,"script":null)
]
}
escape={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
[rendering]

View file

@ -12,25 +12,34 @@ grow_vertical = 2
script = ExtResource("1_xsj3b")
[node name="input_name" type="TextEdit" parent="."]
offset_left = 16.0
offset_top = 72.0
offset_right = 272.0
offset_bottom = 112.0
placeholder_text = "Name"
[node name="input_id" type="TextEdit" parent="."]
layout_mode = 0
offset_left = 16.0
offset_top = 16.0
offset_right = 272.0
offset_bottom = 56.0
placeholder_text = "Name"
placeholder_text = "ID"
[node name="input_hp" type="TextEdit" parent="."]
offset_left = 16.0
offset_top = 72.0
offset_right = 272.0
offset_bottom = 112.0
placeholder_text = "HP"
[node name="input_level" type="TextEdit" parent="."]
layout_mode = 0
offset_left = 16.0
offset_top = 128.0
offset_right = 272.0
offset_bottom = 168.0
placeholder_text = "HP"
[node name="input_level" type="TextEdit" parent="."]
layout_mode = 0
offset_left = 16.0
offset_top = 184.0
offset_right = 272.0
offset_bottom = 224.0
placeholder_text = "Level"
[node name="button" type="Button" parent="."]

View file

@ -13,20 +13,37 @@ script = ExtResource("1_xc6y7")
[node name="Button" type="Button" parent="."]
layout_mode = 0
offset_left = 3.05176e-05
offset_top = 1.52588e-05
offset_right = 90.0
offset_right = 96.0
offset_bottom = 32.0
scale = Vector2(5, 5)
text = "Test"
scale = Vector2(4, 4)
text = "Play"
[node name="Button2" type="Button" parent="."]
layout_mode = 0
offset_top = 192.0
offset_right = 90.0
offset_bottom = 224.0
scale = Vector2(5, 5)
text = "Test2"
offset_top = 184.0
offset_right = 96.0
offset_bottom = 216.0
scale = Vector2(4, 4)
text = "View
"
[node name="Button3" type="Button" parent="."]
layout_mode = 0
offset_top = 368.0
offset_right = 96.0
offset_bottom = 400.0
scale = Vector2(4, 4)
text = "Creator"
[node name="Label" type="Label" parent="."]
layout_mode = 0
offset_left = 488.0
offset_top = 432.0
offset_right = 592.0
offset_bottom = 455.0
scale = Vector2(3, 3)
text = "Version: 0.0.1"
[connection signal="pressed" from="Button" to="." method="_on_button_pressed"]
[connection signal="pressed" from="Button2" to="." method="_on_button_2_pressed"]
[connection signal="pressed" from="Button3" to="." method="_on_button_3_pressed"]

58
scenes/menu/view.tscn Normal file
View file

@ -0,0 +1,58 @@
[gd_scene load_steps=2 format=3 uid="uid://btl7r0wvecyd3"]
[ext_resource type="Script" path="res://scripts/getStats.gd" id="1_dcehj"]
[node name="character_creator" 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_dcehj")
[node name="input_id" type="TextEdit" parent="."]
layout_mode = 0
offset_left = 16.0
offset_top = 16.0
offset_right = 272.0
offset_bottom = 56.0
placeholder_text = "ID"
[node name="output_name" type="TextEdit" parent="."]
layout_mode = 0
offset_left = 16.0
offset_top = 72.0
offset_right = 272.0
offset_bottom = 112.0
placeholder_text = "Name"
editable = false
[node name="output_hp" type="TextEdit" parent="."]
layout_mode = 0
offset_left = 16.0
offset_top = 128.0
offset_right = 272.0
offset_bottom = 168.0
placeholder_text = "HP"
editable = false
[node name="output_level" type="TextEdit" parent="."]
layout_mode = 0
offset_left = 16.0
offset_top = 184.0
offset_right = 272.0
offset_bottom = 224.0
placeholder_text = "Level"
editable = false
[node name="button" type="Button" parent="."]
layout_mode = 0
offset_left = 512.0
offset_top = 400.0
offset_right = 638.0
offset_bottom = 435.0
scale = Vector2(2, 2)
text = "Get"
[connection signal="pressed" from="button" to="." method="_on_button_pressed"]

View file

@ -1,8 +1,8 @@
extends Node
var save_path = "user://player_data.json"
func saveJSON():
var save_path = str("user://player_data"+$input_id.text+".json")
var data := {
"name": $input_name.text,
"hp": $input_hp.text,
@ -19,27 +19,9 @@ func saveJSON():
file_access.store_line(json_string)
file_access.close()
func loadJSON():
if not FileAccess.file_exists(save_path):
return
var file_access = FileAccess.open(save_path, FileAccess.READ)
var json_string = file_access.get_line()
file_access.close()
var json = JSON.new()
var error = json.parse(json_string)
if error:
print("JSON Parse Error: ", json.get_error_message(), " in ", json_string, " at line ", json.get_error_line())
return
var data:Dictionary = json.data
var charName = data.get("name")
var charHP = data.get("hp")
var charLevel = data.get("level")
print(charName)
print(charHP)
print(charLevel)
func _on_button_pressed():
saveJSON()
loadJSON()
func _process(delta):
if Input.is_action_pressed("escape"):
get_tree().change_scene_to_file("res://scenes/menu/main.tscn")

29
scripts/getStats.gd Normal file
View file

@ -0,0 +1,29 @@
extends Node
func loadJSON():
var save_path = str("user://player_data"+$input_id.text+".json")
print(save_path)
if not FileAccess.file_exists(save_path):
return
var file_access = FileAccess.open(save_path, FileAccess.READ)
var json_string = file_access.get_line()
file_access.close()
var json = JSON.new()
var error = json.parse(json_string)
if error:
print("JSON Parse Error: ", json.get_error_message(), " in ", json_string, " at line ", json.get_error_line())
return
var data:Dictionary = json.data
$output_name.text = str("Name: "+data.get("name"))
$output_hp.text = str("HP: "+data.get("hp"))
$output_level.text = str("Level: "+data.get("level"))
func _on_button_pressed():
loadJSON()
func _process(delta):
if Input.is_action_pressed("escape"):
get_tree().change_scene_to_file("res://scenes/menu/main.tscn")

View file

@ -13,5 +13,6 @@ func next():
objectName= "player%d" % playerIndex
print(objectName)
get_node(objectName).start()
get_node(objectName).loadJSON(playerIndex)
playerIndex += 1

View file

@ -7,4 +7,8 @@ func _on_button_pressed():
func _on_button_2_pressed():
get_tree().change_scene_to_file("res://scenes/menu/view.tscn")
func _on_button_3_pressed():
get_tree().change_scene_to_file("res://scenes/menu/create.tscn")

View file

@ -6,6 +6,8 @@ var distanceTo = 0
var active = false
func get_input():
if Input.is_action_pressed("escape"):
get_tree().change_scene_to_file("res://scenes/menu/main.tscn")
var input_direction = Input.get_vector("left", "right", "up", "down")
velocity = input_direction * speed
@ -15,6 +17,9 @@ func _physics_process(delta):
move_and_slide()
distanceTo = position.distance_to(toCalculate)
if distanceTo > 500 and active:
$Label1.visible = false
$Label2.visible = false
$Label3.visible = false
active = false
$camera.enabled = false
get_parent().next()
@ -24,4 +29,27 @@ func start():
$camera.enabled = true
active = true
toCalculate = position
$Label1.visible = true
$Label2.visible = true
$Label3.visible = true
func loadJSON(id):
var save_path = str("user://player_data"+str(id)+".json")
print(save_path)
if not FileAccess.file_exists(save_path):
return
var file_access = FileAccess.open(save_path, FileAccess.READ)
var json_string = file_access.get_line()
file_access.close()
var json = JSON.new()
var error = json.parse(json_string)
if error:
print("JSON Parse Error: ", json.get_error_message(), " in ", json_string, " at line ", json.get_error_line())
return
var data:Dictionary = json.data
$Label1.text = str("Name: "+data.get("name"))
$Label2.text = str("HP: "+data.get("hp"))
$Label3.text = str("Level: "+data.get("level"))

View file

@ -17,3 +17,30 @@ shape = SubResource("RectangleShape2D_kf6qt")
[node name="camera" type="Camera2D" parent="."]
enabled = false
[node name="Label1" type="Label" parent="."]
visible = false
offset_left = -384.0
offset_top = 56.0
offset_right = -288.0
offset_bottom = 88.0
scale = Vector2(2, 2)
text = "1231"
[node name="Label2" type="Label" parent="."]
visible = false
offset_left = -384.0
offset_top = 120.0
offset_right = -288.0
offset_bottom = 152.0
scale = Vector2(2, 2)
text = "1231"
[node name="Label3" type="Label" parent="."]
visible = false
offset_left = -384.0
offset_top = 184.0
offset_right = -288.0
offset_bottom = 216.0
scale = Vector2(2, 2)
text = "1231"