diff --git a/scenes/room/room_camera.gd b/scenes/room/room_camera.gd new file mode 100644 index 0000000..6762fb4 --- /dev/null +++ b/scenes/room/room_camera.gd @@ -0,0 +1,14 @@ +class_name RoomCamera extends Camera2D + + +var room: Room + + +func _ready() -> void: + await owner.ready + room = owner as Room + assert(room != null, "The RoomCamera type must be used only in the room scene. It needs the owner to be a Room node.") + + +func follow_player(_delta: float) -> void: + global_position = room.player.global_position diff --git a/scenes/room/room_camera.gd.uid b/scenes/room/room_camera.gd.uid new file mode 100644 index 0000000..f8778ff --- /dev/null +++ b/scenes/room/room_camera.gd.uid @@ -0,0 +1 @@ +uid://diou146pyb0br