April’s Program: Flywheel


Avoid oncoming cars in this night time driving game.

[Flywheel, 1985]April has been a crazy month. I decided to try something new, pushed along by an unexpected event. I’m writing a book. I joined NaNoWriMo just after last November's event so I didn't expect to do anything until later this year. The surprise was there CampNaNoWriMo event in April. Not to waste the opportunity, I’ve been busy crafting my Sci Fi novel and am now in the final stretch to my 50,000 words goal. Add on top of that a business trip and a family trip and you'll quickly see that my ZX81 hobby gets pushed by the wayside.

Not wanting to skip a month, I decided to dig into my past and present a program from my first ZX81 site. This April I present Flywheel as the program of the month. It is an easy to play racing game. Just dodge the oncoming tail lights using the “Z” and “.” keys to move left and right. Take off from the starting line, pass the cars, avoid the curves, and have fun! You'll rack up about 500 to 1000 points per round. How high a score can you achieve?

I really like this game! It's one of the later ones before I became a C-64 owner. It’s loosely based on the Atari game Night Driver. Since The ZX81 didn’t come with a paddle the car moves a bit slower and being written in BASIC doesn’t help. That said the game is pretty responsive, but could be improved using MCODER II. Sadly, I’d have to rewrite most of the code to do that. Perhaps something I might do after I finish my novel. Even in BASIC, the mechanics and graphics are pretty good for what it is. I did change the program slightly from the original to fix overwriting part of the curved track when the car starts too far over. I also fixed a tail light animation that was in the wrong place. Again, fresh eyes always see ways to improve an old program. I also see many places I could have shrunk the code.

Talking about code, Flywheel is a fun program to study. If you’ve read other articles of mine, you’ll find that this game uses pretty much every trick in the book. You’ll find array animation, loops of every kind, GOSUB's using math, boolean math used to replace IF statements, etc. The track animations are the most interesting. You’ll notice that they display two rows at a time. The curves, keeping the same look, has the entire track in one line but uses AND’s to decide which rows to print. I’m pretty sure I originally was going to use these routines to print over the tail lights. In the end, it was faster using the GOSUB math to animate their movement.

Until next month, enjoy!

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.



2 Comments on this article:

Fly Wheel an Inspiration

Written on Sep 15, 2017 by jgerrie

Hey Steven,

Jim Gerrie here. Contacted you a while ago about a version of your "Joust" program that I did for the TRS-80 MC-10 (The Tandy homage to the ZX81). Just did another one based on your "Fly Wheel" program. In case you're interested, here's a vid of it running: https://youtu.be/840a1QTeFd4
Thanks for the inspiration!

re: Fly Wheel an Inspiration

Written on Jan 28, 2018 by Steven

Looks great, Jim! I’m working to add a link to it on my main site.


Write a comment:

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