Chapter 6 - August 7th, 2013

Title Screen - Fade out

Now that we have the title page up, the next step is the game itself. But before we do that, we need a transition in between.

We start by scanning the keyboard during the title page animation waiting for a keypress to signal to the program that we want to start the game. We could keep it really simple and do a simple cut composed of a clear screen but I like to have something a bit more presentable.

A nice wipe or blinds effect would be nice but we have the problem of the scrolling background. Do we keep the scrolling happening during the transition? Do we stop the transition and run sequentially into the transition? Two problems come to mind.

Keeping the scrolling just adds complexity for such a minor part of the program while stopping the scrolling has the problem where the checkerboard pattern will change back to the striped pattern if the palette is not modified during the screen redraw (see previous chapter).

I had to find something simple that provides a smooth visual transition. After a bit of experimenting I came up with a simple fade-to-black effect.

First thing was to hide the striped pattern used for the checkerboard background by setting the two palette colours to be the same. I chose to make it so that the moment one presses a key to start the game, both colors are made to be bright blue (color 9) and immediately begin the fade. The fade is created by simply reducing each red/green/blue component of all 16 color palette values by 1. This is repeated 4 times with a suitable time delay between each to create the desired fade speed.

The Color Computer 3 has 4 levels of RGB, hence I repeat the reduction 4 times to reach black. With only 4 levels, the fade is either too fast or jagged (pronounced brightness steps). Without going to more complexity, this is the best we can do and looks a bit better than going to an instant black.

It's important to highlight a simple technique here.

By altering the palette color values till all 16 colors are black, that means every pixel on the screen will be black regardless of their color value. We can now redraw the next screen in stealth so the user doesn't see the redraw of the next screen. When the screen is ready, simply set the 16 color palette values to their desired colors, the user only sees the completed screen flash up instantly.

I've made the fade code a subroutine so that it can be called up at any point I wish to transition to another screen.

Enhancements to the title page

As an enhancement to the title page graphics, I added to the text print routine the ability to create a shadow behind printed text. This simply places a black version of the text being printed first, offset by 1 pixel to the right and down. The text then prints using the chosen color in the normal position. This has an effect of highlighting the text making it clearer to see when there are other graphics in the background.

My plan for later is to have a transition occur to the high scores display and maybe a short instructions page. These will be the same pages as the title page but the game credits replaced with a high score table and instructions text. It will cycle between these three with a transition in between each while waiting for a start game keypress.

Coming up next

Coming up next will be the sound routine. Normally I would leave this till later but it needs to be brought forward in this game because the sound routine will be integral to providing the timings for the split screen horizontal scrolling. Stay tuned...



Copyright 2013 by Nickolas Marentes