mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-06 07:50:22 +01:00
Convert demos to Godot 4 using regular expressions in a script
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[gd_resource type="Environment" load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="ProceduralSky" id=1]
|
||||
[sub_resource type="Sky" id=1]
|
||||
|
||||
[resource]
|
||||
background_mode = 2
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
extends KinematicBody2D
|
||||
extends CharacterBody2D
|
||||
|
||||
const MOVE_SPEED = 75
|
||||
const DAMAGE_PER_SECOND = 15
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://enemy.gd" type="Script" id=1]
|
||||
[ext_resource path="res://icon.png" type="Texture" id=2]
|
||||
[ext_resource path="res://icon.png" type="Texture2D" id=2]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 32, 32 )
|
||||
extents = Vector2(32, 32)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=2]
|
||||
extents = Vector2( 38, 38 )
|
||||
extents = Vector2(38, 38)
|
||||
|
||||
[node name="Enemy" type="KinematicBody2D" groups=["enemy"]]
|
||||
position = Vector2( 64, 160 )
|
||||
[node name="Enemy" type="CharacterBody2D" groups=["enemy"]]
|
||||
position = Vector2(64, 160)
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
modulate = Color( 2, 0.6, 0.5, 1 )
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
modulate = Color(2, 0.6, 0.5, 1)
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="AttackArea" type="Area2D" parent="."]
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||
type="StreamTexture2D"
|
||||
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -10,7 +10,7 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.png"
|
||||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
|
||||
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
extends KinematicBody2D
|
||||
extends CharacterBody2D
|
||||
|
||||
# The player's movement speed.
|
||||
const MOVE_SPEED = 240
|
||||
|
||||
var health = 100 setget set_health
|
||||
var health = 100:
|
||||
set(value):
|
||||
# TODO: Manually copy the code from this method.
|
||||
set_health(value)
|
||||
var motion = Vector2()
|
||||
|
||||
onready var progress_bar = $Sprite/ProgressBar
|
||||
@onready var progress_bar = $Sprite2D/ProgressBar
|
||||
|
||||
|
||||
func _process(delta):
|
||||
# Player movement (controller-friendly).
|
||||
var velocity = Vector2.ZERO
|
||||
velocity.x = Input.get_action_strength("move_right") - Input.get_action_strength("move_left")
|
||||
velocity.y = Input.get_action_strength("move_down") - Input.get_action_strength("move_up")
|
||||
velocity.x = Input.get_axis(&"move_left", &"move_right")
|
||||
velocity.y = Input.get_axis(&"move_up", &"move_down")
|
||||
position += velocity * MOVE_SPEED * delta
|
||||
|
||||
# Prevent the player from going outside the window.
|
||||
|
||||
@@ -29,37 +29,37 @@ window/stretch/aspect="expand"
|
||||
|
||||
move_up={
|
||||
"deadzone": 0.2,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":16777232,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":90,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":87,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":90,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_down={
|
||||
"deadzone": 0.2,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":16777234,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":83,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_left={
|
||||
"deadzone": 0.2,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":16777231,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":81,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":65,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":81,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_right={
|
||||
"deadzone": 0.2,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":16777233,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":68,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[rendering]
|
||||
@@ -67,5 +67,5 @@ move_right={
|
||||
quality/driver/driver_name="GLES2"
|
||||
vram_compression/import_etc=true
|
||||
vram_compression/import_etc2=false
|
||||
environment/default_clear_color=Color( 0.133333, 0.2, 0.266667, 1 )
|
||||
environment/default_clear_color=Color(0.133333, 0.2, 0.266667, 1)
|
||||
environment/default_environment="res://default_env.tres"
|
||||
|
||||
@@ -4,21 +4,21 @@
|
||||
[ext_resource path="res://gui.gd" type="Script" id=2]
|
||||
[ext_resource path="res://save_load_json.gd" type="Script" id=3]
|
||||
[ext_resource path="res://save_load_config_file.gd" type="Script" id=4]
|
||||
[ext_resource path="res://icon.png" type="Texture" id=5]
|
||||
[ext_resource path="res://icon.png" type="Texture2D" id=5]
|
||||
[ext_resource path="res://player.gd" type="Script" id=6]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 32, 32 )
|
||||
extents = Vector2(32, 32)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=2]
|
||||
bg_color = Color( 0.45098, 1, 0.152941, 1 )
|
||||
bg_color = Color(0.45098, 1, 0.152941, 1)
|
||||
corner_radius_top_left = 16
|
||||
corner_radius_top_right = 16
|
||||
corner_radius_bottom_right = 16
|
||||
corner_radius_bottom_left = 16
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=3]
|
||||
bg_color = Color( 0, 0, 0, 0.25098 )
|
||||
bg_color = Color(0, 0, 0, 0.25098)
|
||||
corner_radius_top_left = 16
|
||||
corner_radius_top_right = 16
|
||||
corner_radius_bottom_right = 16
|
||||
@@ -27,23 +27,23 @@ corner_radius_bottom_left = 16
|
||||
[node name="Node" type="Node"]
|
||||
|
||||
[node name="Game" type="Node2D" parent="."]
|
||||
position = Vector2( 296, 8 )
|
||||
position = Vector2(296, 8)
|
||||
|
||||
[node name="Player" type="KinematicBody2D" parent="Game"]
|
||||
position = Vector2( 48, 40 )
|
||||
[node name="Player" type="CharacterBody2D" parent="Game"]
|
||||
position = Vector2(48, 40)
|
||||
script = ExtResource( 6 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Game/Player"]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="Game/Player"]
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Game/Player"]
|
||||
texture = ExtResource( 5 )
|
||||
|
||||
[node name="ProgressBar" type="ProgressBar" parent="Game/Player/Sprite"]
|
||||
margin_left = -32.0
|
||||
margin_top = -40.0
|
||||
margin_right = 32.0
|
||||
margin_bottom = -34.0
|
||||
[node name="ProgressBar" type="ProgressBar" parent="Game/Player/Sprite2D"]
|
||||
offset_left = -32.0
|
||||
offset_top = -40.0
|
||||
offset_right = 32.0
|
||||
offset_bottom = -34.0
|
||||
custom_styles/fg = SubResource( 2 )
|
||||
custom_styles/bg = SubResource( 3 )
|
||||
value = 100.0
|
||||
@@ -55,26 +55,26 @@ __meta__ = {
|
||||
[node name="Enemy" parent="Game" instance=ExtResource( 1 )]
|
||||
|
||||
[node name="Enemy2" parent="Game" instance=ExtResource( 1 )]
|
||||
position = Vector2( 376, 304 )
|
||||
position = Vector2(376, 304)
|
||||
|
||||
[node name="Enemy3" parent="Game" instance=ExtResource( 1 )]
|
||||
position = Vector2( 232, 464 )
|
||||
position = Vector2(232, 464)
|
||||
|
||||
[node name="Control" type="Control" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 8.0
|
||||
margin_top = 8.0
|
||||
margin_right = -11.9999
|
||||
margin_bottom = -12.0
|
||||
offset_left = 8.0
|
||||
offset_top = 8.0
|
||||
offset_right = -11.9999
|
||||
offset_bottom = -12.0
|
||||
__meta__ = {
|
||||
"_edit_lock_": true,
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Control"]
|
||||
margin_right = 269.0
|
||||
margin_bottom = 330.0
|
||||
offset_right = 269.0
|
||||
offset_bottom = 330.0
|
||||
custom_constants/separation = 30
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
@@ -82,16 +82,16 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="SaveLoad" type="GridContainer" parent="Control/VBoxContainer"]
|
||||
margin_right = 269.0
|
||||
margin_bottom = 78.0
|
||||
offset_right = 269.0
|
||||
offset_bottom = 78.0
|
||||
custom_constants/vseparation = 8
|
||||
custom_constants/hseparation = 8
|
||||
columns = 2
|
||||
|
||||
[node name="SaveConfigFile" type="Button" parent="Control/VBoxContainer/SaveLoad"]
|
||||
margin_right = 130.0
|
||||
margin_bottom = 35.0
|
||||
rect_min_size = Vector2( 0, 35 )
|
||||
offset_right = 130.0
|
||||
offset_bottom = 35.0
|
||||
rect_min_size = Vector2(0, 35)
|
||||
size_flags_horizontal = 3
|
||||
text = "Save as ConfigFile"
|
||||
script = ExtResource( 4 )
|
||||
@@ -99,10 +99,10 @@ game_node = NodePath("../../../../Game")
|
||||
player_node = NodePath("../../../../Game/Player")
|
||||
|
||||
[node name="LoadConfigFile" type="Button" parent="Control/VBoxContainer/SaveLoad"]
|
||||
margin_left = 138.0
|
||||
margin_right = 268.0
|
||||
margin_bottom = 35.0
|
||||
rect_min_size = Vector2( 0, 35 )
|
||||
offset_left = 138.0
|
||||
offset_right = 268.0
|
||||
offset_bottom = 35.0
|
||||
rect_min_size = Vector2(0, 35)
|
||||
size_flags_horizontal = 3
|
||||
text = "Load as ConfigFile"
|
||||
script = ExtResource( 4 )
|
||||
@@ -110,10 +110,10 @@ game_node = NodePath("../../../../Game")
|
||||
player_node = NodePath("../../../../Game/Player")
|
||||
|
||||
[node name="SaveJSON" type="Button" parent="Control/VBoxContainer/SaveLoad"]
|
||||
margin_top = 43.0
|
||||
margin_right = 130.0
|
||||
margin_bottom = 78.0
|
||||
rect_min_size = Vector2( 0, 35 )
|
||||
offset_top = 43.0
|
||||
offset_right = 130.0
|
||||
offset_bottom = 78.0
|
||||
rect_min_size = Vector2(0, 35)
|
||||
size_flags_horizontal = 3
|
||||
text = "Save as JSON"
|
||||
script = ExtResource( 3 )
|
||||
@@ -121,11 +121,11 @@ game_node = NodePath("../../../../Game")
|
||||
player_node = NodePath("../../../../Game/Player")
|
||||
|
||||
[node name="LoadJSON" type="Button" parent="Control/VBoxContainer/SaveLoad"]
|
||||
margin_left = 138.0
|
||||
margin_top = 43.0
|
||||
margin_right = 268.0
|
||||
margin_bottom = 78.0
|
||||
rect_min_size = Vector2( 0, 35 )
|
||||
offset_left = 138.0
|
||||
offset_top = 43.0
|
||||
offset_right = 268.0
|
||||
offset_bottom = 78.0
|
||||
rect_min_size = Vector2(0, 35)
|
||||
size_flags_horizontal = 3
|
||||
text = "Load as JSON"
|
||||
script = ExtResource( 3 )
|
||||
@@ -133,18 +133,18 @@ game_node = NodePath("../../../../Game")
|
||||
player_node = NodePath("../../../../Game/Player")
|
||||
|
||||
[node name="OpenUserDataFolder" type="Button" parent="Control/VBoxContainer"]
|
||||
margin_top = 108.0
|
||||
margin_right = 269.0
|
||||
margin_bottom = 143.0
|
||||
rect_min_size = Vector2( 0, 35 )
|
||||
offset_top = 108.0
|
||||
offset_right = 269.0
|
||||
offset_bottom = 143.0
|
||||
rect_min_size = Vector2(0, 35)
|
||||
hint_tooltip = "Click this button to check the saved files using the operating system's file manager."
|
||||
text = "Open User Data Folder"
|
||||
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="Control/VBoxContainer"]
|
||||
margin_top = 173.0
|
||||
margin_right = 269.0
|
||||
margin_bottom = 453.0
|
||||
rect_min_size = Vector2( 0, 280 )
|
||||
offset_top = 173.0
|
||||
offset_right = 269.0
|
||||
offset_bottom = 453.0
|
||||
rect_min_size = Vector2(0, 280)
|
||||
custom_constants/line_separation = 4
|
||||
bbcode_enabled = true
|
||||
bbcode_text = "Use the arrow keys or controller to move the player.
|
||||
|
||||
@@ -3,9 +3,9 @@ extends Button
|
||||
# ConfigFile can store any Godot type natively.
|
||||
|
||||
# The root game node (so we can get and instance enemies).
|
||||
export(NodePath) var game_node
|
||||
@export var game_node: NodePath
|
||||
# The player node (so we can set/get its health and position).
|
||||
export(NodePath) var player_node
|
||||
@export var player_node: NodePath
|
||||
|
||||
const SAVE_PATH = "user://save_config_file.ini"
|
||||
|
||||
@@ -26,7 +26,7 @@ func save_game():
|
||||
|
||||
config.save(SAVE_PATH)
|
||||
|
||||
get_node("../LoadConfigFile").disabled = false
|
||||
get_node(^"../LoadConfigFile").disabled = false
|
||||
|
||||
|
||||
# `load()` is reserved.
|
||||
@@ -47,6 +47,6 @@ func load_game():
|
||||
var game = get_node(game_node)
|
||||
|
||||
for enemy_config in enemies:
|
||||
var enemy = preload("res://enemy.tscn").instance()
|
||||
var enemy = preload("res://enemy.tscn").instantiate()
|
||||
enemy.position = enemy_config.position
|
||||
game.add_child(enemy)
|
||||
|
||||
@@ -5,9 +5,9 @@ extends Button
|
||||
# and to store Vector2 and other non-JSON types you need `var2str()`.
|
||||
|
||||
# The root game node (so we can get and instance enemies).
|
||||
export(NodePath) var game_node
|
||||
@export var game_node: NodePath
|
||||
# The player node (so we can set/get its health and position).
|
||||
export(NodePath) var player_node
|
||||
@export var player_node: NodePath
|
||||
|
||||
const SAVE_PATH = "user://save_json.json"
|
||||
|
||||
@@ -32,16 +32,18 @@ func save_game():
|
||||
position = var2str(enemy.position),
|
||||
})
|
||||
|
||||
file.store_line(to_json(save_dict))
|
||||
file.store_line(JSON.new().stringify(save_dict))
|
||||
|
||||
get_node("../LoadJSON").disabled = false
|
||||
get_node(^"../LoadJSON").disabled = false
|
||||
|
||||
|
||||
# `load()` is reserved.
|
||||
func load_game():
|
||||
var file = File.new()
|
||||
file.open(SAVE_PATH, File.READ)
|
||||
var save_dict = parse_json(file.get_line())
|
||||
var json = JSON.new()
|
||||
json.parse(file.get_line())
|
||||
var save_dict = json.get_data()
|
||||
|
||||
var player = get_node(player_node)
|
||||
# JSON doesn't support complex types such as Vector2.
|
||||
@@ -57,6 +59,6 @@ func load_game():
|
||||
var game = get_node(game_node)
|
||||
|
||||
for enemy_config in save_dict.enemies:
|
||||
var enemy = preload("res://enemy.tscn").instance()
|
||||
var enemy = preload("res://enemy.tscn").instantiate()
|
||||
enemy.position = str2var(enemy_config.position)
|
||||
game.add_child(enemy)
|
||||
|
||||
Reference in New Issue
Block a user