How do I assign a phantom Camera to an Area2D and set its limits? #299
-
So I am making a 2D platformer levels, and the levels are in a "Room" system like Megaman or Metroid, and each room can be of various shapes and sizes, and I use an area2d with rectangle collision box to mark each room's boundaries. So the thing is that when I move from one room to another room, there would be a tween transition between the rooms like in the above mentioned games, so I want the camera to limit to each room's Area2d, how would I do that, and how would I assign a new phantomcamera to each room? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
There's a There is a 2D example scene called |
Beta Was this translation helpful? Give feedback.
Found the issue.
It doesn't work because you're only assigning the name of the Node in the
camera.set_limit_target("CollisionShape2D")
insideChangeCamera.gd
.To get it to work, the parameter needs to be a fullNodePath
. When supplying an invalidNodePath
value, it basically resets the limit that you've applied from the inspector. It probably should return an error and prevent resetting the limit, so will add that in as an update soon.A working code example would then look like: