8-Bit Pet Wurm
Posted: Thu Oct 17, 2024 6:04 am
Concept demo featuring the interactive 8-Bit Worm: he's 8-pixels long!
Turn by press LEFT/RIGHT, and can also speed up a little bit by pressing the UP arrow.
Uses the approach discussed here: (dynamic background)
viewtopic.php?t=7947
but uses the scaling registers to operate effectively at 160x82 (could have used 160x80, was just experimenting)
For a little fun, just hold down LEFT or RIGHT arrow to spin in a circle and see which way you end up launching.
One major thing I learned in this: I think there is a bug in cc65's handling of the unsigned long type. I had trouble storing the 3-bytes of the clock into a native long type (I think the operator = assignment is faulty, for the long type). This caused trouble when doing "delta time" checks. I worked around it by not using operator= and just poke-copy the values myself. But also then I realized for my purposes, I can just use 2-bytes of the clock anyway (actually even 1-byte would be sufficient).
Also learned that time(0) call doesn't seem to work in cc65 - but the rand() call does work (just init with srand using your own clock call, as done here).
The attached ZIP file contains the C source code (cc65). But the PRG itself is standalone and can run on its own.
Could probably evolve this into a two-player Tron-cycle game (and using 8-direction rather than the classic 4-direction only). Keep the cycle as 2 or 3 pixel, and etch the path into the background - think there is performance there for it (with a full colored background, not just black screen).
Try It Now!
Turn by press LEFT/RIGHT, and can also speed up a little bit by pressing the UP arrow.
Uses the approach discussed here: (dynamic background)
viewtopic.php?t=7947
but uses the scaling registers to operate effectively at 160x82 (could have used 160x80, was just experimenting)
For a little fun, just hold down LEFT or RIGHT arrow to spin in a circle and see which way you end up launching.
One major thing I learned in this: I think there is a bug in cc65's handling of the unsigned long type. I had trouble storing the 3-bytes of the clock into a native long type (I think the operator = assignment is faulty, for the long type). This caused trouble when doing "delta time" checks. I worked around it by not using operator= and just poke-copy the values myself. But also then I realized for my purposes, I can just use 2-bytes of the clock anyway (actually even 1-byte would be sufficient).
Also learned that time(0) call doesn't seem to work in cc65 - but the rand() call does work (just init with srand using your own clock call, as done here).
The attached ZIP file contains the C source code (cc65). But the PRG itself is standalone and can run on its own.
Could probably evolve this into a two-player Tron-cycle game (and using 8-direction rather than the classic 4-direction only). Keep the cycle as 2 or 3 pixel, and etch the path into the background - think there is performance there for it (with a full colored background, not just black screen).
Try It Now!