Again reworking map loading system. Some progress
This commit is contained in:
parent
eb513f9db9
commit
d275f97bf7
22
Global.gd
22
Global.gd
@ -51,12 +51,22 @@ func RemoveScene(scene):
|
||||
camera.remove_child(scene)
|
||||
|
||||
func AddMap(load_on, mapname):
|
||||
var maps = load(mapname).instance().get_children()
|
||||
for i in maps:
|
||||
load_on.add_child(i)
|
||||
print('Added ', i)
|
||||
for _i in self.get_children():
|
||||
print("Nodes visible at addMap ", _i)
|
||||
for _i in get_parent().get_children():
|
||||
print("Nodes visible before addMap ", _i)
|
||||
print("Adding map ", mapname)
|
||||
var addedscene = load(mapname).instance()
|
||||
#addedscene.set_position(Vector2(-617,-300))
|
||||
get_parent().add_child(addedscene)
|
||||
for _i in get_parent().get_children():
|
||||
print("Nodes visible at addMap ", _i)
|
||||
# var maps = load(mapname).instance().get_children()
|
||||
# for i in maps:
|
||||
# load_on.add_child(i)
|
||||
# print('Added ', i)
|
||||
#
|
||||
# #There's a chance that 1) this is an on-load problem 2) the nodes never get instanced/loaded
|
||||
# for _i in self.get_children():
|
||||
# print("Nodes visible at addMap ", _i)
|
||||
|
||||
#Go to scene by name
|
||||
func GoToScene(scene):
|
||||
|
@ -145,6 +145,7 @@ resource_local_to_scene = true
|
||||
6/z_index = 0
|
||||
|
||||
[node name="Map1" type="Node2D"]
|
||||
z_index = -1
|
||||
|
||||
[node name="background" type="TileMap" parent="."]
|
||||
tile_set = ExtResource( 3 )
|
||||
|
@ -8,7 +8,8 @@ onready var background_map = get_node("../background")
|
||||
onready var vegetation_map = get_node("../vegetation")
|
||||
onready var interaction_map = get_node("../interaction_map")
|
||||
onready var player_interaction_map = get_node("../player_interaction")
|
||||
onready var cell_size = background_map._get_cell_size()
|
||||
#onready var cell_size = background_map._get_cell_size()
|
||||
onready var cell_size = 32
|
||||
|
||||
var velocity = Vector2()
|
||||
var world_position
|
||||
|
@ -5,13 +5,11 @@ onready var player = get_node("/root/base_scene/Player")
|
||||
onready var background_map = get_node("/root/base_scene/background")
|
||||
onready var screen_size = self.get_viewport_rect().size
|
||||
|
||||
func _init():
|
||||
func _ready():
|
||||
var map_name = "res://Maps/river_intersection.tscn"
|
||||
print(self)
|
||||
Global.AddMap(self, map_name)
|
||||
|
||||
func _ready():
|
||||
var map_name = "res://Maps/river_intersection"
|
||||
|
||||
calculate_bounds()
|
||||
Global.current_camera = self
|
||||
$dev_statistics.visible = Global.dev_stats
|
||||
|
@ -27,6 +27,7 @@ script = ExtResource( 6 )
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
position = Vector2( 705.297, 1197.88 )
|
||||
z_index = 15
|
||||
z_as_relative = false
|
||||
current = true
|
||||
limit_left = 0
|
||||
limit_top = 0
|
||||
@ -132,7 +133,6 @@ visibility_mode = 1
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="dev_statistics" type="MarginContainer" parent="Camera2D"]
|
||||
visible = false
|
||||
margin_left = -617.0
|
||||
margin_top = -300.0
|
||||
margin_right = 612.0
|
||||
|
Loading…
Reference in New Issue
Block a user