January’s Program: Fireball


A simple ZX81 dodging game. Try not to get burned.

[Fireball, 1984]January’s program of the month, Fireball, marks a first for me. Although I’ve used a few different methods to type in my programs, I’ve always gone back to a Windows so I could use EightyOne to generate the program files and images. However, for my birthday, my wife took me to the Apple store and I upgraded my old laptop to a shiny new MacBook Pro.

Although I used ZXSP to type in December’s program, I sadly still went back to my old laptop to finish up. The OS X based ZXSP program doesn’t support the TZX format nor does its screen shots look as good as EightOne’s. So today I used Wineskin to package EightyOne, thus making this month marks the first time I’ve competed a ZX81 program on a Mac. More on that in a bit, but first go play Fireball. It is a simple dodging game using the ‘Z’ key to move down and the ‘.’ key to move up.

Presenting the ZX81 program of the month requires me to do a bit more than just typing it in. I make three different versions of the save file. First, I create a standard .P file. Almost all ZX81 emulators can run this file and it is also the file type I support to generate the program listings. I also create a TZX tape file. I then compress it and the .P file into a ZIP file which can then be run by the JtyOne emulator. It is the same file that I also offer for download. I then upload the files, edit the program entry on my site, and create the download link. Lastly, I generate a screen shot or two. EightyOne generates very nice TV style images. Unfortunately, it saves the images in the BMP format. Because of this, I convert the images to PNG before uploading them to the site. All of this work goes pretty quick, especially now that I can run EightyOne on my Mac. This ends my work on the program itself.

The next step is to write the article. I use FocusWriter to write the article. FocusWriter is portable and offers a nice distraction free writing mode. I usually then edit the article, running it through PolishMyWriting to catch any glaring mistakes. I then format the article, adding images and the download link, on my site and post it for all to read.

Since it very easy for me to get distracted, lately I’ve started listening to Coffitivity while writing my article. The TV is usually on in my house and there are times when you just want to block it out and concentrate. Coffitivity does a great job of providing random conversations and sounds that mix well with everything around and allows the brain to focus. Worth a try, even in a quiet house.

[Fireball, 1984]Okay enough on my work habits, let’s get back to the program. Fireball is a playable side scroller where you, the less-than sign, and the fireballs move quickly towards each other. As you move to the left, you can also move up or down to dodge two fireballs, moving right and approaching quickly. To make things interesting, each successful pass causes the walls to squeeze together which, incidentally, are also deadly to you. Overall, a responsive BASIC game that is diverting and fun.

Fireball uses a couple of clever programming techniques to stay interesting. For example, the program uses an array to hold four different fireballs. This adds some uniqueness to the game without hindering the movement. Although it wouldn’t have taken much to animate the fireballs, doing so would have added a small amount of lag which would detract form the games responsiveness.

Another trick was to wait until after the first fireball passed, plus or minus a few spaces. This delay provides a little stress to the player as you can compensate for the first fireball, but must wait until the second appears to react fully. The second fireball does sort of pop on the screen. A small concession to keep things quick.

Speed is somewhat of an illusion as both you and the fireballs are moving towards each other. This doubles how quickly the elements meet and improves the overall flow of the game. Also, by keeping the walls as part of the setup and not in the main program, it keeps the main code loop short.

The action is ultimately contained in eleven lines of code, from 100-200. Three of those lines deal with moving and displaying the fireballs. Two lines display and move the character. Two more check if you hit anything. And the last one increments the score. Since you can’t move two high or low due to the walls, the movement check is much simpler than you’ve seen in most of my other programs.

Much of the rest of the program deals with setting up the game, some 18 lines of code. That may come as a surprise, but most games work out this way. Like most things in life, preparation often takes the longest. The rest of the program deals your success or failure.

Altogether, Fireball satisfactorily provides you an enjoyable, if short, experience.

If you want to run this program on your Android phone or tablet you can download a compressed copy of the program to your device. You’ll need to save the .p version of the program to your device to allow Zed Ex (Beta) to run it.



Comments on this article:

No comments so far.

Write a comment:

Type The Letters You See.
[captcha image][captcha image][captcha image][captcha image][captcha image][captcha image]
not case sensitive