Racking up a New Score in This ZX81 Animation


Pixel skies and fun scores make for more interesting looks.

Not a lot of time for programming this month, but I did get around to adding coins to my running game. Funny how little things take time to hack about. I’m not completely happy with it, but it works. Run 3 ML does give a whole new meaning to infinite runner.

# Grabbing all the gold.

There still is just running and the same sky from last time, but the score routine is quite a bit different. In this version, rotating coins fly across the sky and you grab them. As you do, the score pops up and flies away. Personally, I really like the look.

The only problem I had was the score printing was slower than the coins. There was a visible lag when you pick them up. Most of the time I spent was rearranging the code to reduce the latency. In the end, I think it worked pretty well. There is still a tiny bit, but I can work on that in the future.

Run 3 ML, ZX81 Night Screenshot, 2022 by Steven ReidRun 3 ML, ZX81 Night Screenshot, 2022 by Steven Reid

# Taking out the lag.

Now, if you bother to look at the assembly, you’ll see some remnants of what the routine looked like. I already had the coin routine in there, I just needed to make it move. That was the easiest part. I just put in a space and made the print location a variable.

This part worked pretty well, but I still had that score going. To fix that, I moved it into the routine when the coins get to the runner. Doing that allowed me to clear the coins and then print each of the flying score frames. The only issue is that printing the frames takes too long. The problem, it seems, is the routine that is clearing the score.

That routine is a loop that prints blanks over a number of lines. I unwound that, moving the clear routine into each of the frames instead. That sped things up considerably. Although, it didn’t work at first. Seems I had had the frames backwards in my mind. Shows how much you forget in a month.

# Racking up that gold!

With that done, the animation is complete. As noted, it is still a little slow. In the final version I’ll probably replace all the prints with a custom display routine. But for now, it works. Now to add in the boxes and a routine to jump them.



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