SaveStation, save & load properly
This commit is contained in:
parent
d4acde846c
commit
847670821d
16 changed files with 129 additions and 13 deletions
|
@ -6,3 +6,13 @@ func _ready():
|
|||
var parent = get_parent()
|
||||
if parent is WORLD:
|
||||
parent.currentLevel = self
|
||||
|
||||
|
||||
func save():
|
||||
var data = {
|
||||
"filename": get_filename(),
|
||||
"parent": get_parent().get_path(),
|
||||
"position_x": position.x,
|
||||
"position_y": position.y
|
||||
}
|
||||
return data
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
[ext_resource path="res://Levels/Level.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Scenes/TileMap.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="Level" type="Node2D"]
|
||||
[node name="Level" type="Node2D" groups=[
|
||||
"Persists",
|
||||
]]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="TileMap" parent="." instance=ExtResource( 2 )]
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://Levels/Level.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Levels/Door.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://Levels/DoorConnections/00_link_01.tres" type="Resource" id=3]
|
||||
[ext_resource path="res://Scenes/Objects/SaveStation.tscn" type="PackedScene" id=4]
|
||||
|
||||
[node name="Level_00" instance=ExtResource( 1 )]
|
||||
|
||||
|
@ -13,3 +14,7 @@ tile_data = PoolIntArray( 0, 0, 4, 1, 0, 196609, 2, 0, 196609, 3, 0, 196609, 4,
|
|||
position = Vector2( 312, 144 )
|
||||
connection = ExtResource( 3 )
|
||||
new_level_path = "res://Levels/Level_01.tscn"
|
||||
|
||||
[node name="SaveStation" parent="." index="2" instance=ExtResource( 4 )]
|
||||
position = Vector2( 215, 160 )
|
||||
scale = Vector2( 0.998604, 1 )
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
[gd_scene load_steps=6 format=2]
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://Levels/Door.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Levels/Level.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://Levels/DoorConnections/00_link_01.tres" type="Resource" id=3]
|
||||
[ext_resource path="res://Levels/DoorConnections/01_99.tres" type="Resource" id=4]
|
||||
[ext_resource path="res://Scenes/Player/MissilesPowerup.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://Scenes/Objects/SaveStation.tscn" type="PackedScene" id=6]
|
||||
|
||||
[node name="Level_01" instance=ExtResource( 2 )]
|
||||
|
||||
|
@ -16,6 +17,9 @@ position = Vector2( 88, 144 )
|
|||
connection = ExtResource( 4 )
|
||||
new_level_path = "res://Levels/Level_99.tscn"
|
||||
|
||||
[node name="SaveStation" parent="OutDoor" index="2" instance=ExtResource( 6 )]
|
||||
position = Vector2( -26, 16 )
|
||||
|
||||
[node name="InDoor" parent="." index="2" instance=ExtResource( 1 )]
|
||||
position = Vector2( 8, 144 )
|
||||
scale = Vector2( -1, 1 )
|
||||
|
@ -23,4 +27,4 @@ connection = ExtResource( 3 )
|
|||
new_level_path = "res://Levels/Level_00.tscn"
|
||||
|
||||
[node name="MissilesPowerup" parent="." index="3" instance=ExtResource( 5 )]
|
||||
position = Vector2( 47, 146 )
|
||||
position = Vector2( 25, 146 )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue