Re: [stella] Generating a health bar without ruining your health...

Subject: Re: [stella] Generating a health bar without ruining your health...
From: "Roger Williams" <mer02@xxxxxxxxxxxxx>
Date: Thu, 27 Sep 2001 19:56:20 -0700
> My original code was based on a six
> digit score type six slot health bar that based on the P0 variable changed
> the colors of the six sprites, but I then realized that there are actually
> two sprites repeated three times not six individual sprites so it shot
> version out of the water fairly quickly.

Glenn gave one good suggestion, probably the *best* in fact,
but one that would make my knees knock a bit as a beginning
Stella programmer.  Mixing playfield and sprite graphics and
lining everything up creates whole minefields in which bugs can

Another tactic I'd suggest would be defining a "bar character set"
for the 6-digit score routine to use (it would only have to have 8
characters, from blank to $11111111) and superimposing the
6-digit-score output on a playfield graphic background.  This
would give you 48-pixel fine control of the bar length with very
little logic or math.

Of course, Glenn's method is superior because you could make
the bar the width of the screen if you wanted and get 160 pixel
resolution for its length -- if you can get everything to line up and
do the math in the time available.  I'm still circling around my
first ever original project using sprites so I may be overstating
the difficulty.  But I know for sure that the 48-pixel code is
there to be ripped off while you will have to line up the playfield
and fine-end sprite code yourself.  It is also a PITA to deal
with the reversed middle PF register (what were they thinking?)

--Roger Williams

Archives (includes files) at
Unsub & more at

Current Thread