From 253844755be6fac6c4e0a5a573f4a6a9bdc9efa4 Mon Sep 17 00:00:00 2001 From: yuki Date: Sun, 23 Nov 2025 07:37:43 -0300 Subject: [PATCH] make simple camera --- scenes/room/room_camera.gd | 14 ++++++++++++++ scenes/room/room_camera.gd.uid | 1 + 2 files changed, 15 insertions(+) create mode 100644 scenes/room/room_camera.gd create mode 100644 scenes/room/room_camera.gd.uid 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