This post is a portion of Part 11 in my on going series about 2D Game Development using the Allegro 5 library. These posts are in course order. You can see all of the posts in this course by clicking the “2D Game Development” button at the top of this site.

Backgrounds

Up until now, our backgrounds have been very boring (we haven’t had any). In this chapter, we aim to fix that. Backgrounds are an interesting topic as they are very unique. On one hand, they can be thought of as still images. On the other, they can be moved around, and that would seem to make them sprites. To further complicate things, they can be one, or many images aligned in a multitude of ways, with or without transparency. The result is that the solutions we use feel familiar, as their roots are tied to sprites, but are modified.

Pick Your Poison

There are many technologies that define how we handle backgrounds. The deciding factor is often the type of game being made. One solution we will look at is fixed images. With fixed images, you create large static bitmaps and use them for your background images. These are nice since artists can take time and make them very pretty. The problem is that they tend to be large, and they are difficult to modify. On the other end, you can have tile based backgrounds. These can be created on the fly and are dynamically sizable. The one you chose will probably depend on game type.

Other Stuff

Other stuff to consider are things like parallax scrolling and isometric view angles. With parallax scrolling, we layer multiple background on top of each other and move each at a different rate. The result is that the background has a simulated depth and can be passed off as 3D. Isometrics aren’t something we are going to cover here, but it involves showing the map at a slight angle. Think of Starcraft. The game is actually 2D, but is shown at an isometric angle to give the illusion of 3D.