[SOLVED]Camera following both the tilemap and the player

I recently added a tilemap into my game with the help of tiled, I created its own layer since if I put in on the base layer it’s going to cover everything I’ve put in the scene.

Now here’s the problem, when I stat the game the camera centers to both the player and the tilemap
This is not what I want, the tilemap should just stay put and the only thing the camera should be following is the player.

This is the only thing I have in the events which is the camera set to following the player.

and If I change its layer to base layer everything becomes fine except that it now covers every other object like a blanket.

You could change the z order of your tilemap to be lower than everything else and leave it on the base layer, but I bet the problem is that you have the player on the tile layer also. Move it to the base layer and you should be good.

Every layer has a unique camera. And a unique set of z order numbers.

If you have the tilemap on its own layer, and you want that layer’s camera to move the same as another layer, you have to move that tilemap layers camera the same way you do the other layer.

You can:

Make another camera event with the exact same settings (but target the tilemaps layer).

Make a camera event that sets the tilemap layer’s position to the camera position of the other layer (there are expressions to get the camera center x/y of a layer)

Put the tilemap on the same layer as everything else, but update its z order appropriately (higher z order objects will be on top of lower z order objects on the same layer. So set the tile ap to 0 or -100 or something to have it under everything else on the same layer.)

Thanks! it’s working now, I just needed to change the z order.

1 Like