prog8/examples/swirl.p8

29 lines
515 B
Plaintext
Raw Normal View History

%import c64utils
2018-09-30 23:01:39 +00:00
2019-07-29 21:11:13 +00:00
main {
2018-09-30 23:01:39 +00:00
const uword width = 40
const uword height = 25
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
2018-09-30 23:01:39 +00:00
while true {
2019-07-12 17:01:36 +00:00
ubyte x = msb(sin8u(msb(ball.anglex)) as uword * width)
ubyte y = msb(cos8u(msb(ball.angley)) as uword * height)
c64scr.setcc(x, y, 81, ball.color)
2019-07-12 17:01:36 +00:00
ball.anglex+=800
ball.angley+=947
ball.color++
2018-09-30 23:01:39 +00:00
}
}
}