Croissant Runtime
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
crsn/examples/screen_bounce.csn

24 lines
505 B

; Set log level to "info" or above for the best results!
(
(sc-init 800 600)
(sc-opt SCREEN_AUTO_BLIT 1)
(sc-opt SCREEN_FPS 25)
(sym x r0) (sym y r1) (sym dx r2) (sym dy r3) (sym color r5)
(ld x 5) (ld y 0)
(ld dx 1) (ld dy 1)
(ld color 0x3300ff)
(:loop)
(add color 0x000001)
(sc-px x y color)
(add x dx (z? (ld dx 1)))
(cmp x 799 (eq? (ld dx -1)))
(add y dy (z? (ld dy 1)))
(cmp y 599 (eq? (ld dy -1)))
(j :loop)
)