How do I make the screen move along with the character?

I would like to know this because right now, My character is stuck inside a little box and there is not much room to put obstacles.

by putting the objects that are supposed to be in the same place on another layer.

How do I do that? I can’t

Add a “Camera center on object” for your player object on the base layer.
Add a “Set Camera X” and “Y” for each other layer to the CameraX and CameraY of the baselayer.

click on add layer, add a new layer, select object, click on layer in popertys on the left and select the newly created layer. done


no camera events needed.

I tried both and neither works. I am using it on a chromebook so is that the problem?

to get the facts staight.

what do you want exactly.
is it
a) Have the objects in the same screen position at all times? (UI elements, like healthbar)
or
b) have them stationary in the scene, so that the player can pass them, so they can leave the screen?

then your objects.
is your player on the base layer?
are the objects, the player can pass, till they move out of sight also on the base layer?
are the objects, you want to be visible at all time NOT on the base layer?

then your camera.
what camera event do you use? do you have only 1?

No. I would like The screen to move when the character goes outside of the screen. So you never DON’T see the player unless it fell down.

then you need camera events.

I found them. But how do I configure the events?

they have a description
the object to center the object on is self explanatory. Its the Player
the layer reference is the affected layer, the layer with the objects that move relative to the player, and the player itself. It usually is the base layer, or “”. you can leave it empty, and gd recognizes it as the base layer by default.
if you use the within limits event, then you have to declare the positions, that the camera cannot leave, aka minXposition,maxXposition,minYposition,maxYposition.

Ok, thanks! I got it to work. Only with jumping though.

What is with jumping?
It would be much easier to help You, if you would explain. If you want accurate & fast help, stop making us guess.

As for my guess:
If you want to make the camera follow the player only on the X-axis (left/right only) use the camera event position, instead of center on object, and set the x position of player to player.x ()
Look up the platformer example, if you have problems with it.

1 Like