Last active
December 31, 2018 18:59
-
-
Save sehugg/85265288161d042f478629c1c94b1835 to your computer and use it in GitHub Desktop.
Happy 2019 demo in batariBASIC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set kernel_options no_blank_lines pfcolors | |
set romsize 8kSC | |
set smartbranching on | |
const pfres=18 | |
pfclear | |
rem make sprites go behind playfield | |
CTRLPF = %00000101 | |
rem define the playfield | |
playfield: | |
....X..X.XXXX.XXXX.XXXX.X...X... | |
....X..X.X..X.X..X.X..X..X.X.... | |
....XXXX.XXXX.XXXX.XXXX...X..... | |
....X..X.X..X.X....X......X..... | |
....X..X.X..X.X....X......X..... | |
................................ | |
.......XXX.XXXX.XX...XXX........ | |
.........X.X..X..X..X...X....... | |
.......XX..X..X..X...XXXX....... | |
......X....X..X..X......X....... | |
......XXXX.XXXX.XXX..XXX........ | |
................................ | |
.......XXXXX......XX.......X.... | |
.XX....X.X.X......XX.......X.... | |
.XX.XX.XXXXX.XXX..XXX.XX..X.X... | |
.XX.XX.X.X.X.XXX.XXXX.XX.X.X.X.. | |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | |
end | |
rem define the colors for each playfield row | |
pfcolors: | |
$40 | |
$28 | |
$38 | |
$48 | |
$58 | |
$68 | |
$04 | |
$04 | |
$04 | |
$04 | |
$04 | |
$82 | |
end | |
rem define Y position and velocity | |
rem (16-bit signed fixed-point) | |
dim ypos = a.b | |
dim yvel = c.d | |
rem initialize variables and fire first rocket | |
yvel = 0.0 | |
t = 0 | |
gosub fireone | |
rem main loop | |
mainloop | |
if yvel = 0 then t = 10 | |
if t <> 0 then gosub explode | |
ypos = ypos + yvel | |
yvel = yvel + 0.015 | |
player0y = ypos | |
if b{0} then REFP0 = 8 else REFP0 = 0 | |
COLUP0 = rand | |
drawscreen | |
goto mainloop | |
rem fire next rocket | |
fireone | |
player0: | |
%00000100 | |
%00010000 | |
%00000000 | |
%00001000 | |
%00010000 | |
%00001000 | |
%00011000 | |
%00001000 | |
end | |
x = (rand & 127) + 12 | |
player0x = x | |
ypos = 100.0 | |
yvel = -1.40 | |
e = rand | |
if e < 64 then yvel = yvel + 0.25 | |
e = rand | |
if e < 64 then yvel = yvel + 0.10 | |
e = rand | |
if e < 64 then yvel = yvel + 0.05 | |
COLUBK = $02 | |
return | |
rem called while rocket is exploding | |
explode | |
t = t - 1 | |
if t = 0 then goto fireone | |
player0: | |
%01000100 | |
%00000000 | |
%00000000 | |
%00010001 | |
%00000000 | |
%00000100 | |
%10000000 | |
%00010010 | |
%00000000 | |
%00001000 | |
%00100000 | |
%00000000 | |
%01000010 | |
%00000000 | |
%00100000 | |
%00000100 | |
end | |
COLUBK = rand | |
NUSIZ0 = $7 | |
player0x = x - 12 | |
return | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment