hello, I want to make a secret room with a phantom camera, but I have a problem, when I enter the secret room (camera 0-1), everything works, when I return to camera 0, everything still works, but when I enter camera 0-2, the camera is set to camera 1, I know why this happens, camera 0 simply has the priority of camera 1, but I don't know how to make camera 0 change between 2 other cameras
#how to make camera 01 and 02 with the same camera (PhantomCamera2d)
1 messages · Page 1 of 1 (latest)
`extends Node
@export var player: CharacterBody2D
@export var Camera_Zone0: PhantomCamera2D
@export var Camera_Zone1: PhantomCamera2D
@export var Camera_Zone2: PhantomCamera2D
@export var Camera_Zone3: PhantomCamera2D
var current_camera_zone: int = 0
func update_current_zone(body, zone_a, zone_b):
if body == player:
match current_camera_zone:
zone_a:
current_camera_zone = zone_b
zone_b:
current_camera_zone = zone_a
update_camera()
func update_camera():
var cameras = [Camera_Zone0,Camera_Zone1,Camera_Zone2,Camera_Zone3]
for camera in cameras:
if camera != null:
camera.priority = 0
match current_camera_zone:
0:
Camera_Zone0.priority = 1
1:
Camera_Zone1.priority = 1
2:
Camera_Zone2.priority = 0
Zone Transitions
func _on_zone_01_body_entered(body):
update_current_zone(body, 0, 1)
func _on_zone_12_body_entered(body: Node2D) -> void:
update_current_zone(body, 0, 2)
func _on_zone_23_body_entered(body: Node2D) -> void:
update_current_zone(body, 2, 3)
`
camera manager script
Wouldn't it be simpler to use the same camera but change its settings when you enter the new room?
You could even replace the node entirely.
I have no rooms (there is a secret on the left and the rest of the map on the right)
When i say rooms i refer to them abstractly.
Just put an Area that changes the settings of the camera at the entrance of the area you want it changed in.