Google+

Wednesday, August 24, 2011

Let's Make A Game! Episode 11: Parallax? I Hardly Knew Her Lax!

So parallaxing backgrounds.

First of all, what are they? It's not something you would see in Super Mario Bros. 1, 2, or 3. Usually, in those games the background moves along with the player. However, in other NES games, (and especially Super Nintendo games) they would sometimes take advantage of them. They work really well to give the illusion of depth in a 2-D plane without having to put in a lot of processing power


In this example, we're going to have three layers. One layer will be left alone to remain as the background. The next one will move from right to left, and the third will move from the right to left a little faster than the second. All of these layers appear to be the same texture, too, which is kind of cool.

We're also using an array. An array is normally a group of things that can be worked on very quickly. For example, instead of saying that we want to work with Texture 1, 2, 3, 4, 5 and 6 in a row, we can just say that we want Array 1 to handle all of that. This array is going to be a group of textures that act as a background. This way we can make it appear like they're seamlessly moving from one side of the screen to the other.

Now here's the cool thing: We're only creating ONE of the parallaxing background classes, but we're using it TWICE. It's just that one will be moving faster than the other so it appears that we have several different textures.

After my initial confusion and difficulty entering in some of these items, this lesson turned out to be not as complicated as I thought it was going to be. Now I'm looking forward to the next one: Adding enemies. Glee!