I'm doing a platformer/beat em up like Smash Brothers, so I want the camera to stay on the characters while they move around.
I want the camera to follow the players and zoom out but have a limit relative to the level. I was thinking in my level editor id add a bounding box that says camera cant move further than these points and then maybe the same for a zoom out point.
I dont know if this the best approach.
Currently my camera code finds the middle point between all players and "Looks at" that point. When the distance between players reaches X the camera starts to pan out. The camera zooms in/out relative to the distance between players, but will eventually reach a max zoom and lock there.
I was wondering if anyone has any pointers/advice on this?
Camera logic to keep level and players within view
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Camera logic to keep level and players within view
I'm personally using Tiled with bump and outlining my maps wherever I don't want the camera to go beyond with a special tile that has an attribute "camera_collide." I put the camera rect in the bump collision world and only process its collisions against tiles with the "camera_collide" attribute. It works pretty well so far.
Re: Camera logic to keep level and players within view
For cameras I strongly suggest skimming this article:
http://www.gamasutra.com/blogs/ItayKere ... ollers.php
It's pretty exhaustive, including even the smash bros. example.
http://www.gamasutra.com/blogs/ItayKere ... ollers.php
It's pretty exhaustive, including even the smash bros. example.
Who is online
Users browsing this forum: Majestic-12 [Bot], zorg and 3 guests