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