Skip to content

Commit

Permalink
fix: Enforce rooms being located at (0,0)
Browse files Browse the repository at this point in the history
  • Loading branch information
Balloonpopper committed Apr 27, 2022
1 parent c302b7e commit 0bfae0a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 11 additions & 0 deletions addons/escoria-core/game/core-scripts/esc/esc_room_manager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,17 @@ func init_room(room: ESCRoom) -> void:
if escoria.main.current_scene == null:
escoria.main.set_scene(room)

# If the room node isn't at (0,0), the walk_stop function will offset the
# player by the same number of pixels when they're at the terrain edge and
# move them when it shouldn't.
if room.position != Vector2(0,0):
escoria.logger.report_errors(
"ESCRoomManager.init_room: Room node not at (0,0)",
[
"The room node's coordinates must be (0,0) instead of %s." % room.position
]
)

_perform_script_events(room)


Expand Down
1 change: 0 additions & 1 deletion game/rooms/room02/room02.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ tracks/3/keys = {
[sub_resource type="CapsuleShape2D" id=8]

[node name="room2" type="Node2D"]
position = Vector2( -2, 0 )
script = ExtResource( 6 )
global_id = "room2"
esc_script = "res://game/rooms/room02/esc/room02_bridge.esc"
Expand Down

0 comments on commit 0bfae0a

Please sign in to comment.