Dynamic terrain and weather effects

I’m not an artist, but I know my way around Photoshop and I love pixel art. so making the art for Major Escape look better is part of the learning process. Now that most of the mechanics are in the game, and the code for stuff like game options is in, it’s time to look at remaking some of the current art in the game. I will probably revisit the art again just before releasing the game but now is a good time to redo some art, add new things like weather effects and make the game prettier in general.

Here you can see a few screen shots of new stuff that has been added…

capture
A beautiful sunset… at least I think so.

capture2
It’s raining!

So far I’ve been working mostly on the background images that make the landscape. I am not only making them look better but also more dynamic. There are 2 elements that make the background loop more alive: color changes and dynamic terrain.

I’m sorry I keep using the work dynamic but would you rather I use the term “procedurally generated” terrain? Some elements are static and some are generated differently every time you play the game.

In this case, the first set of mountains are generated as you move through the level, while the second set further are simply a sprite that repeats over and over. How are the dynamic mountains created? you may ask. Well they are made up of triangles. Every side rise or slope is made up of 2 triangles stuck together to make the effect of continuous terrain. Check this pic out:

action_shot_C01

As you can see, with math, you can make a triangle that creates the rise or the slope, and then another one that complements the first, to create a block with its top side skewed. As the player moves forward you keep creating new blocks while removing the ones that exit the screen. Here’s how these triangles are created together:

action_shot_C02
Its important to note that in Game Maker the top left corner of the screen is 0,0 for x,y. Y increases in number as you move down the screen.

The first triangle (brown) sets the base and the length of the block, while the second triangle (purple) sets the slope/height of the mountain. As you can see some of the values are shared as the same point of x,y (like x1,y1 and x4,y4), and that’s how you make them stick and look like a block. The next block of triangles would use the same value of x5,y5 as its first point and create the other values concurrently, making the mountain with each new block.

This is a simple solution that adds a bit of dynamism to the background and makes it a little less boring.

jmr