Understanding the camera

I came across something interesting and wanted to know if it was a feature or a bug, dunno.

I created a pretty large map because my current game has 400x400 tiles, and the scene is 4000x2400 pixels.

Then I centered my camera (0) on my Player object in an empty event (so it follows every frame). My Player is set on a layer above the Base layer, so it’s Base Layer > Player layer.

When testing the game, the camera seems to fail to follow the Player, it like loses track of the Player as it walks around on the map and eventually walks off-screen.

However, if I put my Player object on the Base layer, the camera has no problems tracking the Player at all.

Is this expected behavior? Why is the camera failing to follow the Player character when the Player is on a different / not the Base layer?

I think what’s happening is that you are centering camera on Player in Base Layer.


If you write PlayerLayer instead of nothing then the camera will start working correctly.

Thanks for the speedy response!

For some reason, setting the Layer breaks the character movement. Like my Player character really struggles / is stuck.

How are you doing it?

[Empty condition] > center camera on player (layer “player”, camera 0")

I literally have no other events but this. It stops my character from moving.

Do you have anything on the base layer that can be used as a movement reference? If not, then it can appear like the player isn’t moving because the camera is centred on them and so the player never shifts from the centre of the screen, even though the player is moving.

My base layer has a bunch of sprites locked in place, acting as a tileset. (I know there’s an actual tileset plugin but it was acting up last time I used it so I prefer this method for now)

The camera is now centering on Player Layer so it doesn’t follow up the objects in Base Layer. To fix it, add another action and there, centre the camera on Player but in the Base Layer.

This is just like how the objects of UI layer never moves from its place.

1 Like

Can you give a screen shot? Because you’ve put a double quote after the 0.

So the player is on the layer called player? And the other sprites are on the base layer? And the centre camera is the only event action? I assume you have top down behaviour on the player object?

Wow, thank you, I’ve been at this for hours and exhausted. It actually worked. I didn’t know the cameras behaved like this, it makes sense in a way.

MrMen: The player is on a “player” layer, and the other sprites are on the “base” layer. The only action I had was following the player on the “player” layer but didn’t know I had to do the same for the base layer, too.