prog8/examples/swirl.p8

27 lines
613 B
Plaintext
Raw Normal View History

%import textio
2020-09-19 22:17:33 +00:00
%zeropage basicsafe
2018-09-30 23:01:39 +00:00
; Note: this program is compatible with C64 and CX16.
2018-09-30 23:01:39 +00:00
2020-09-19 22:17:33 +00:00
main {
const uword screenwidth = txt.DEFAULT_WIDTH
const uword screenheight = txt.DEFAULT_HEIGHT
2019-07-12 17:01:36 +00:00
struct Ball {
uword anglex
uword angley
2018-10-10 07:21:20 +00:00
ubyte color
2019-07-12 17:01:36 +00:00
}
sub start() {
Ball ball
repeat {
ubyte x = msb(sin8u(msb(ball.anglex)) * screenwidth)
ubyte y = msb(cos8u(msb(ball.angley)) * screenheight)
2020-08-27 16:10:22 +00:00
txt.setcc(x, y, 81, ball.color)
2020-09-19 22:17:33 +00:00
ball.anglex+=366
ball.angley+=291
2019-07-12 17:01:36 +00:00
ball.color++
2018-09-30 23:01:39 +00:00
}
}
}