I’m currently stuck on how to get GDevelop’s camera to behave similar to a Camera in Metroid or a more recent Castlevania/Bloodstained game.
This would mean the camera follows 3 rules:
- In most scenarios follows the player, except for the below situations.
- Stops moving on the X or Y access if it would display “past the wall/floor”
- Stops moving on the X or Y access if the player reaches a Door, such as to a Save Room or Boss room.
Here’s an example:
Notice a few things in this example:
- The camera initially only follows the player on the Y axis, because following on X would display past the wall.
- When going to the room that is only 1 screen tall/wide, it doesn’t follow the player at all.
- The camera only centers on the player if it wouldn’t expose past the wall
- Upon entering the save room, the camera snaps to the center of the save room
- After exiting the save room, the camera snaps back to NOT follow the player (which would expose part of the save room), but instead moves back to a spot where the player is infront of the door, and the camera doesn’t expose “past the wall”.
Does anyone have any ideas of a clean(ish) way to do this?
Originally, my thoughts were:
- Create a hidden screen sized object (CameraCollision) that is centered to the Camera X/Y. This allows to detect for “is something visible on the screen” and “is something about to collide with the screen”
- Create a hidden screen sized object (RoomCollision) that sits over the save room.
- Set up events so that: the Camera follows the player unless CameraCollision is in Collision with RoomCollision, wherein the camera stops.If the player is in collision with RoomCollision, the Camera centers on RoomCollision.
- The ALMOST worked. The camera does stop moving right before you reach into the save room area. The Camera then does jump to the center of the save room no problem once the player enters it. The issue is that when the player LEAVES the save room, the camera stays put where it is on the Save Room. I’ve also tried to use the “Separate objects” event but that doesn’t seem to work, either.
Any/all input is greatly appreciated.