Categories
Gamedev

GM Camera Follow

Hey Gang! I had a buddy ask about how to developed my camera system in Boomer, in particular, the smooth movement in following the player.

It starts with a simple object that I named oCamera.

We start with a Create event that has a couple of Macros to setup our resolution, scale, and the most important ingredient CAM_SMOOTH 0.1. This variable controls the smooth motion.

We then create an End Step, because want this update to occur towards the end of the processing.

My Endstep has a couple of tidbits that are only useful for my development, so keep an eye on that. This setup offers me a lot of flexibility.

For instance, if you notice line 8, my camera will change if I enter a Dungeon. I actually move my camera slightly higher. This works for my dungeon levels as its more important for the camera to show more above Boomer. The typical Boomer level, the camera is pretty centered, showing the same amount of space above and below the player. The dungeon, the camera is slightly lower, similar to Mario games, showing more space above the player. This is just preference and me being detailed, but it can it is not needed for the camera setup.

My last event is Alarm 0. This is a simple window_center(); call, which lets me ensure I can center my camera when needed. Consider it a way to reset if needed.

I think this approach is the simplest that takes several general principals into consideration. You have a locked in resolution that you can quickly control via Macros.

You have camera shake ‘prebaked’ into the code in a very simple manner that is very effective.

We have the ability to adjust the camera based on events, like specific rooms, or even player events. Take a look at my death event, the camera will switch from following the player, to following the death animation sprite. This is really powerful because you can quickly code instance that will automatically switch your camera between objects. All this can be coded directly into the camera for a simple, all in one approach.

Leave a Reply

Your email address will not be published. Required fields are marked *