prog8/examples/swirl.p8

27 lines
613 B
Plaintext
Raw Normal View History

%import textio
2020-09-20 00:17:33 +02:00
%zeropage basicsafe
2018-10-01 01:01:39 +02:00
; Note: this program is compatible with C64 and CX16.
2018-10-01 01:01:39 +02:00
2020-09-20 00:17:33 +02:00
main {
const uword screenwidth = txt.DEFAULT_WIDTH
const uword screenheight = txt.DEFAULT_HEIGHT
2019-07-12 19:01:36 +02:00
struct Ball {
uword anglex
uword angley
2018-10-10 09:21:20 +02:00
ubyte color
2019-07-12 19:01:36 +02: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 18:10:22 +02:00
txt.setcc(x, y, 81, ball.color)
2020-09-20 00:17:33 +02:00
ball.anglex+=366
ball.angley+=291
2019-07-12 19:01:36 +02:00
ball.color++
2018-10-01 01:01:39 +02:00
}
}
}