Children are not added
This commit is contained in:
parent
91d651b3f3
commit
eb513f9db9
@ -50,12 +50,13 @@ func RemoveScene(scene):
|
||||
var camera = get_node("/root/base_scene/Camera2D")
|
||||
camera.remove_child(scene)
|
||||
|
||||
func AddMap(mapname):
|
||||
func AddMap(load_on, mapname):
|
||||
var maps = load(mapname).instance().get_children()
|
||||
for i in maps:
|
||||
print(get_tree().get_root())
|
||||
get_tree().get_root().add_child(i)
|
||||
load_on.add_child(i)
|
||||
print('Added ', i)
|
||||
for _i in self.get_children():
|
||||
print("Nodes visible at addMap ", _i)
|
||||
|
||||
#Go to scene by name
|
||||
func GoToScene(scene):
|
||||
|
@ -9,4 +9,3 @@ func _on_Btn_PlayGame_pressed():
|
||||
|
||||
func _on_Btn_LoadGame_pressed():
|
||||
Global.GoToScene("loadgame_screen")
|
||||
|
||||
|
@ -5,6 +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():
|
||||
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()
|
||||
@ -22,7 +27,7 @@ var max_y_pixel = 0
|
||||
|
||||
#function that calculates the borders/bounds of the map
|
||||
func calculate_bounds():
|
||||
for _i in self.get_parent().get_children():
|
||||
for _i in self.get_children():
|
||||
print("Nodes visible ", _i)
|
||||
var used_cells = background_map.get_used_cells()
|
||||
for pos in used_cells:
|
||||
|
@ -1,8 +1,18 @@
|
||||
extends Node2D
|
||||
|
||||
func _init():
|
||||
var map_name = "res://Maps/river_intersection.tscn"
|
||||
Global.AddMap(map_name)
|
||||
|
||||
#func realize():
|
||||
# print("At ready")
|
||||
# for _i in self.get_children():
|
||||
# print("Nodes visible at init ", _i)
|
||||
#
|
||||
#func _init():
|
||||
# var map_name = "res://Maps/river_intersection.tscn"
|
||||
# Global.AddMap(self, map_name)
|
||||
# realize()
|
||||
#
|
||||
#func _ready():
|
||||
# realize()
|
||||
|
||||
# for _i in self.get_children():
|
||||
# print("Nodes visible ",_i)
|
||||
# if _i is TileMap:
|
||||
|
Loading…
Reference in New Issue
Block a user