make simple camera
This commit is contained in:
parent
d23a7c4c36
commit
253844755b
2 changed files with 15 additions and 0 deletions
14
scenes/room/room_camera.gd
Normal file
14
scenes/room/room_camera.gd
Normal file
|
|
@ -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
|
||||
1
scenes/room/room_camera.gd.uid
Normal file
1
scenes/room/room_camera.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://diou146pyb0br
|
||||
Loading…
Add table
Reference in a new issue