Unknown Camera Error[SOLVED]

I’m trying to make a cutscene for my game by moving the camera across the whole scene while going through all the backgrounds and stuff. Now I’m facing some problems. The center of the camera cannot be aligned to the middle of the screen. It’s now aligned to a random position. I think it might be because I reset the resolution and camera zoom of the game, but I’m not sure what is happening exactly.
image
These events are triggered at the beginning of the scene.

The default resolution of my game is 2400*1440(I know it’s too big, but I’m trying to lower the resolution inside the game and adjust the camera zoom to avoid performance problems). It is controlled by a global variable named “resolution”. Theoretically, the camera should be centered at the middle of the object I placed exactly at the middle of the screen shown in the editor, but something seems to be off. I still can’t fix this to proceed my game. Could anyone please help?


(This is what happened when I run the scene)

Have you tried, “center the camera on an object” ?

Why not just change resolution in settings (found upper-left of the screen project), click Properties, and then adjust the Resolution for width and height to your requirement.

As for helping with your problem, it’s best to show what your events tab and scene objects look like. It might be a layer overlap, or a wrong use of event.

I tried and it worked. Although it still can’t solve the problem, but I guess this could be a temporary solution. Thank you!

1 Like

I added the variable to control the resolution because I want to make changing the resolution easier, like the player can change the variable inside the game.

This is what the event tab looks like. I really can’t find much useful in it.

And here is the editor. I abandoned the other layers as soon as I found the problem, but nothing changed, so I don’t think the other layers could have caused it.
[/quote]

First the problem likely occured because you used the Action ‘Camera Zoom, in base layer’, this action causes you to zoom in on everything inside Base Layer (your image is inside Base Layer).
Like Pyroqua said, you’re better off using the ‘Center camera on object’ action. Leave the zoom on default, since your image already covers the whole screen resolution.

Next,
I will assume you want that ‘Sun above the clouds’ image to completely fill the screen?

In events tab:
You can try using an event for it,

  • Condition: (you can leave it empty)
  • Actions:
  1. Set object postion to: x = 0, y = 0.
    2,3. Use the action to change you object width or height. Use the expression: SceneWindowWidth() and SceneWindowHeight(). (The image will now follow the windows size (not resolution)

If it was another other action you required, you can try searching the expression in the wiki.
https://wiki.gdevelop.io/gdevelop5/all-features/window/reference/#conditions

Yes, but at first I was planning to just have the image put right in the middle of the scene with its default size (1200*900) and make it appear to fill the screen by increase the camera zoom. Unfortunately, that doesn’t seem to work. I will just try using another object to control the camera by using the ‘Center camera on object’ action. Thanks for helping!