Fix broken room camera (#437)

This commit is contained in:
Julian Murgia
2021-11-13 10:14:18 +01:00
committed by GitHub
parent 524fc05cb0
commit 555f820254
3 changed files with 10 additions and 14 deletions

View File

@@ -4,13 +4,6 @@ extends Node2D
class_name ESCRoom, "res://addons/escoria-core/design/esc_room.svg"
# Emitted when room has finished ":setup" event.
signal room_setup_done
# Emitted when room has finished ":ready" event.
signal room_ready_done
# Debugging displays for a room
# NONE: No debug display
# CAMERA_LIMITS: Display the camera limits
@@ -82,6 +75,14 @@ func _ready():
add_child(game)
move_child(game, 0)
# Determine whether this room was run from change_scene or directly
if escoria.main.has_node(name):
is_run_directly = false
else:
is_run_directly = true
if escoria.main.current_scene == null:
escoria.main.set_scene(self)
if player_scene:
player = player_scene.instance()
add_child(player)
@@ -104,11 +105,7 @@ func _ready():
if global_id.empty():
global_id = name
# Determine whether this room was run from change_scene or directly
if escoria.main.has_node(name):
is_run_directly = false
else:
is_run_directly = true
# Manage player location at room start
if player != null \

View File

@@ -40,7 +40,7 @@ func set_scene(p_scene: Node) -> void:
if current_scene != null:
clear_scene()
if p_scene.is_inside_tree() and not p_scene.get_parent() != self:
if p_scene.is_inside_tree() and p_scene.get_parent() != self:
p_scene.get_parent().remove_child(p_scene)
add_child(p_scene)

View File

@@ -20,7 +20,6 @@ __meta__ = {
"_edit_vertical_guides_": [ ]
}
global_id = "room15"
esc_script = "res://game/rooms/room15/esc/wrong_file.esc"
player_scene = ExtResource( 4 )
camera_limits = [ Rect2( 0, 0, 1289, 555 ) ]