save_load.tscn 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. [gd_scene load_steps=10 format=3 uid="uid://w7nl5fe4vheb"]
  2. [ext_resource type="PackedScene" path="res://enemy.tscn" id="1"]
  3. [ext_resource type="Script" path="res://gui.gd" id="2"]
  4. [ext_resource type="Texture2D" uid="uid://dpm1oolm8wr02" path="res://sea_turtle.png" id="2_g2wd8"]
  5. [ext_resource type="Script" path="res://save_load_json.gd" id="3"]
  6. [ext_resource type="Script" path="res://save_load_config_file.gd" id="4"]
  7. [ext_resource type="Script" path="res://player.gd" id="6"]
  8. [sub_resource type="RectangleShape2D" id="1"]
  9. size = Vector2(64, 64)
  10. [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_lkphp"]
  11. bg_color = Color(0.152941, 0.152941, 0.152941, 1)
  12. corner_radius_top_left = 2
  13. corner_radius_top_right = 2
  14. corner_radius_bottom_right = 2
  15. corner_radius_bottom_left = 2
  16. [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_smouc"]
  17. bg_color = Color(0.458824, 0.631373, 0.262745, 1)
  18. corner_radius_top_left = 2
  19. corner_radius_top_right = 2
  20. corner_radius_bottom_right = 2
  21. corner_radius_bottom_left = 2
  22. [node name="Node" type="Node"]
  23. [node name="Game" type="Node2D" parent="."]
  24. position = Vector2(296, 8)
  25. [node name="Player" type="CharacterBody2D" parent="Game"]
  26. position = Vector2(48, 40)
  27. motion_mode = 1
  28. script = ExtResource("6")
  29. [node name="CollisionShape2D" type="CollisionShape2D" parent="Game/Player"]
  30. shape = SubResource("1")
  31. [node name="Sprite2D" type="Sprite2D" parent="Game/Player"]
  32. texture_filter = 1
  33. scale = Vector2(4, 4)
  34. texture = ExtResource("2_g2wd8")
  35. [node name="ProgressBar" type="ProgressBar" parent="Game/Player"]
  36. offset_left = -32.0
  37. offset_top = -50.0
  38. offset_right = 32.0
  39. offset_bottom = -33.0
  40. theme_override_colors/font_outline_color = Color(0.152941, 0.152941, 0.152941, 1)
  41. theme_override_constants/outline_size = 6
  42. theme_override_font_sizes/font_size = 13
  43. theme_override_styles/background = SubResource("StyleBoxFlat_lkphp")
  44. theme_override_styles/fill = SubResource("StyleBoxFlat_smouc")
  45. value = 100.0
  46. [node name="Enemy" parent="Game" instance=ExtResource("1")]
  47. [node name="Enemy2" parent="Game" instance=ExtResource("1")]
  48. position = Vector2(376, 304)
  49. [node name="Enemy3" parent="Game" instance=ExtResource("1")]
  50. position = Vector2(232, 464)
  51. [node name="Control" type="Control" parent="."]
  52. layout_mode = 3
  53. anchors_preset = 15
  54. anchor_right = 1.0
  55. anchor_bottom = 1.0
  56. offset_left = 8.0
  57. offset_top = 8.0
  58. offset_right = -11.9999
  59. offset_bottom = -12.0
  60. grow_horizontal = 2
  61. grow_vertical = 2
  62. [node name="VBoxContainer" type="VBoxContainer" parent="Control"]
  63. layout_mode = 0
  64. offset_right = 269.0
  65. offset_bottom = 330.0
  66. script = ExtResource("2")
  67. [node name="SaveLoad" type="GridContainer" parent="Control/VBoxContainer"]
  68. layout_mode = 2
  69. columns = 2
  70. [node name="SaveConfigFile" type="Button" parent="Control/VBoxContainer/SaveLoad"]
  71. layout_mode = 2
  72. size_flags_horizontal = 3
  73. text = "Save ConfigFile"
  74. script = ExtResource("4")
  75. game_node = NodePath("../../../../Game")
  76. player_node = NodePath("../../../../Game/Player")
  77. [node name="LoadConfigFile" type="Button" parent="Control/VBoxContainer/SaveLoad"]
  78. layout_mode = 2
  79. size_flags_horizontal = 3
  80. text = "Load ConfigFile"
  81. script = ExtResource("4")
  82. game_node = NodePath("../../../../Game")
  83. player_node = NodePath("../../../../Game/Player")
  84. [node name="SaveJSON" type="Button" parent="Control/VBoxContainer/SaveLoad"]
  85. layout_mode = 2
  86. size_flags_horizontal = 3
  87. text = "Save JSON"
  88. script = ExtResource("3")
  89. game_node = NodePath("../../../../Game")
  90. player_node = NodePath("../../../../Game/Player")
  91. [node name="LoadJSON" type="Button" parent="Control/VBoxContainer/SaveLoad"]
  92. layout_mode = 2
  93. size_flags_horizontal = 3
  94. text = "Load JSON"
  95. script = ExtResource("3")
  96. game_node = NodePath("../../../../Game")
  97. player_node = NodePath("../../../../Game/Player")
  98. [node name="OpenUserDataFolder" type="Button" parent="Control/VBoxContainer"]
  99. layout_mode = 2
  100. tooltip_text = "Click this button to check the saved files using the operating system's file manager."
  101. text = "Open User Data Folder"
  102. [node name="RichTextLabel" type="RichTextLabel" parent="Control/VBoxContainer"]
  103. layout_mode = 2
  104. size_flags_vertical = 3
  105. bbcode_enabled = true
  106. text = "Use WASD, arrow keys or controller to move the player.
  107. Use the save and load buttons to save/load the game with the respective format (each format is its own savegame)."
  108. [connection signal="pressed" from="Control/VBoxContainer/SaveLoad/SaveConfigFile" to="Control/VBoxContainer/SaveLoad/SaveConfigFile" method="save_game"]
  109. [connection signal="pressed" from="Control/VBoxContainer/SaveLoad/LoadConfigFile" to="Control/VBoxContainer/SaveLoad/LoadConfigFile" method="load_game"]
  110. [connection signal="pressed" from="Control/VBoxContainer/SaveLoad/SaveJSON" to="Control/VBoxContainer/SaveLoad/SaveJSON" method="save_game"]
  111. [connection signal="pressed" from="Control/VBoxContainer/SaveLoad/LoadJSON" to="Control/VBoxContainer/SaveLoad/LoadJSON" method="load_game"]
  112. [connection signal="pressed" from="Control/VBoxContainer/OpenUserDataFolder" to="Control/VBoxContainer" method="_on_open_user_data_folder_pressed"]