[SOLVED] Create Geometry Dash Camera System

Hello!, I’m trying to recreate Geometry Dash while maintaining the original mechanics, and I’m having complications creating the camera system.

The camera is not supposed to move in the Y axis, but above three blocks in height it adjusts to rise one block above, and then adjusts again when lowered. How do I get this?

https://youtu.be/_TOcf7orAOk?si=CQBd5qZvfvMnG8ry

I remain attentive to any contribution. I recommend watching the attached video to learn how the camera system works.

1 Like

What exactly do you know about how cameras work?
I think if you want the Y-axis you need to make a bar that stays on the screen and test if the boundary of the player is above or below the bar, and move the camera accordingly. I assume the camera goes back to normal if the entirety of the player is in collision with the bar. I think if I look at the video, the bar might actually change in size depending on where the player is, like during the spaceship part the camera doesn’t move in the Y-axis at all.
Do you think you know how the X-axis works, or no?

1 Like

First of all, I recognize that I didn’t specify about the type of player, since as you mention, there are parts where the gameplay changes. An apology.

The type of camera system I’m looking to recreate is the one using the cube, not the ship one. I know perfectly well that in ship mode, the camera is completely limited on the Y axis, and that’s not what I’m looking for (at the moment).

As for what you mention as a possible solution, I would like to have more details on how the camera system could be developed according to what you mention; any detailed explanation is welcome.

Finally, the X-axis is not a problem for me. The easiest solution I see is to constrain the camera to the left from the 0 position to the end of the level. As I say, my problem is more in how to apply it for the Y axis.

Thank you very much for your reply. I remain attentive.

1 Like

Okay, so, this is quite simple when you break it down, but there are a couple things you have to consider. We need to continuously teleport the box to the boundaries of the player to make it work as expected, and also change the camera position to the box as well. In the first condition below it teleports the box to the player if the top of the player is above the top of the box, but because of how GDevelop works, making the box go back down would be a little more complicated. See, the origin point of an object is normally at it’s top, which is why teleporting the top of the box to the top of the player is easy, but if I were to do the same thing I did for the top for the bottom, the top of the box would teleport to the bottom of the player, and it would be an infinite loop, which isn’t what you want. Instead of that you have to find the distance between the bottom of the two objects and add it to the Y value of the box (because adding Y goes down and subtracting goes up, weird, am I right?).


Example of Y-axis working as expected.
I hope this helped, by now you should probably understand it, if not, try experimenting a bit with the box yourself.

1 Like

This is exactly what I was looking to recreate! :partying_face:

I can’t express how grateful I’m for you taking the time to explain how the system works (including the demo). I definitely learned things I never imagined I would see.

Here’s a demonstration I recorded of the entire camera system working according to the game mechanics.

Again, THANK YOU SO MUCH for all your help! It’s great to see people like you in the community!

1 Like

No problem, I like helping people out, plus it gives me things to think about, it benefits both of us. If you want more help you can message me if you want. :slight_smile:

1 Like