I was wondering how I would go about making some flashing text for a game-over screen that reads "press z to try again". I tried using modulo however when I attempted this it would display the text for one frame and then show (about) 30 empty frames.
Any help on a simple and effective method would be greatly appreciated.
BAND is a powerful command I must admit. I need to explore it at some point. However, I tend to use MOD for my timing works.
cls() n=0 circfill(0,0,90,5) -- show overlay effect repeat color(0) if (n%16<8) color(7) print("g a m e",48,60) print("o v e r",48,68) color(n*8) print("press z to try again",24,76) flip() n+=1 until btn(4)
Tiny additional point that actually resetting the counter avoids weirdness at the integer overflow boundary:
n = (n + 1) % 10 color(n == 0 and 1 or 7)
Technically this is also avoided if your frame count is a power of 2, but so far I've found I want more control than that. Resetting also means maintaining a separate counter per effect, which may or may not meet your needs.
[Please log in to post a comment]