How do I push players off the camera

How do I keep the players out of the camera border? My game is a 2 player platform shooter, and the camera is centered between the players. But you can go outside of the camera. How do I fix this?

You state the actual result, but what is the expected result? Do you want walls? Do you want to bounce players back to the centre? Do you want to zoom out as much as needed?

1 Like

Yes - clarify how you want to do so and it’ll be easier to assist you.
For example, in Metal Slug if the camera advances to the right / left and the second player is at edge, they will be dragged along at the same speed of the camera.
For vertical (up/down) levels, the player left behind usually loses their life when they are off-screen

Is this tutorial something like what you’re looking for?

I might not be understanding what you’re asking, but if the video above isn’t what you’re looking for, perhaps look at setting the layer ‘zoom’ as the players get to the edges of the screen?