I’m currently working on a game similar to Arkanoid, but I want to have levels which are taller than the initial camera viewport allows. In order to do this,Â I put together a camera similar to the one in Super Mario World. If you haven’t seen this video, it’s worth a watch:
In my case, I only need a much simpler version of this camera. I don’t need any horizontal movement, and I don’t need any logic like the Mario camera uses to follow multiple platforms, etc. Here’s what I wanted the camera to do:
- When the ball is near the bottom of the level, snap the camera to the bottom so that it doesn’t move.
- When the ball gets high enough to go off screen, unsnap the camera so that it follows the ball.
- When the ball gets to the top of the screen, snap the camera to the top so that it is no longer following the ball.
- While the camera is snapped to the top, if the ball moves below the viewport, start following the ball again.
Here’s what it looks like in practice:
In the next post, I’ll show how I made the camera using Playmaker, and a custom action script.