Here is my entry;
Rem Project: Dark Basic Pro Project
Rem Created: Thursday, July 08, 2010
Rem ***** Main Source File *****
`Space invaders by jammysoft
`press 1 to start
`Arrowkeys to move and space to fire
`images
set window on
set display mode 224,260,16
set window size 448,520
SET WINDOW LAYOUT 0, 1, 4
set text size 5
sync on
SYNC RATE 60
speed=600 : lin=1 :move=2 :drop=0 : ssx=50 :pltime=timer():pl1firetime=timer() : score=0 :level=0 :invadershot1=0 : in2vadershot=0 :hiscore=2000
`background
create bitmap 1,224,260
box 0,0,224,260,RGB(0,50,155),rgb(0,0,0),rgb(0,50,155),rgb(0,0,0)
for temp=1 to 500
dot rnd(224),rnd(200),rgb(55,55,55)
NEXT
for cir=1 to 150
ink RGB(128,150-cir,0),rgb(0,0,0)
circle 112,300,cir
ink RGB(cir/2,cir/2,0),rgb(0,0,0)
circle 112,299,cir
next cir
get image 13,0,0,224,260
ink rgb(255,255,255),rgb(0,0,0)
set current bitmap 0
cls
`draw to screen
score$="0000" :hiscore$="2000" :lives=3
y=1
repeat
read x
if x=0 then y=y+1
If x=98 then y=y+12
if y>110 then ink rgb(255,0,0),rgb(0,0,0)
if y>125 then ink RGB(0,180,0),rgb(0,0,0)
if y>140 then ink rgb(255,255,255),rgb(0,0,0)
if y>180 then ink RGB(0,180,0),rgb(0,0,0)
if y>218 then ink rgb(255,0,0),rgb(0,0,0)
if y>247 then ink rgb(255,255,255),rgb(0,0,0)
if x>0 and x<98 then dot x,y
until x=99
ink rgb(255,255,255),rgb(0,0,0)
`invaders
get image 1,1,1,13,9,1
get image 2,1,20,13,28,1
get image 3,1,39,13,47,1
get image 4,1,58,13,66,1
get image 5,1,77,13,85,1
get image 6,1,96,13,104,1
`bonus ship
get image 7,1,115,17,122,1
`player
get image 8,1,133,16,141,1
`shots
get image 9,2,152,3,160,1
get image 10,1,171,4,178,1
`bunker
get image 11,1,188,27,209,1
`explosions
`shot
get image 12,1,219,8,229,1
`ship
get image 14,1,239,17,249,1
do
set current bitmap 1
cls
for bunker=1 to 4
paste image 11,(50*bunker)-25,200
get image 99+bunker,(50*bunker)-25,200,(50*bunker),226
next bunker
set current bitmap 0
SET WINDOW TITLE "For more games visit www.weejammy.com"
`START SCREEN
GOSUB STARTSCREEN
play:
`draw sprites
` player
gosub drawplayer
`bunkers
gosub drawBunkers
`invaders
gosub drawinvaders
`bonus sauser
`cls
time=timer()
`main
repeat
`background
paste image 13,0,0
`move invaders
if timer()>time+speed
if lin=1
if toggle=1 then toggle=-1 else toggle=1
for s=1 to 11
if sprite exist(s)=1
sx=Sprite x(s) : sy=Sprite y(s): si=sprite image(s)
sx=sx+Move
if drop=1 then sy=sy+8
si=si+toggle
sprite s,sx,sy,si
if sx>bsx then bsx=sx
if sx<ssx then ssx=sx
endif
next s
lin=2
endif
if lin=2 and time+speed+(speed/5)<timer()
for s=12 to 22
if sprite exist(s)=1
sx=Sprite x(s) : sy=Sprite y(s): si=sprite image(s)
sx=sx+Move
if drop=1 then sy=sy+8
si=si+toggle
sprite s,sx,sy,si
if sx>bsx then bsx=sx
if sx<ssx then ssx=sx
endif
next s
lin=3
endif
if lin=3 and time+speed+((speed/5)*2)<timer()
for s=23 to 33
if sprite exist(s)=1
sx=Sprite x(s) : sy=Sprite y(s): si=sprite image(s)
sx=sx+Move
if drop=1 then sy=sy+8
si=si+toggle
sprite s,sx,sy,si
if sx>bsx then bsx=sx
if sx<ssx then ssx=sx
endif
next s
lin=4
endif
if lin=4 and time+speed+((speed/5)*3)<timer()
for s=34 to 44
if sprite exist(s)=1
sx=Sprite x(s) : sy=Sprite y(s): si=sprite image(s)
sx=sx+Move
if drop=1 then sy=sy+8
si=si+toggle
sprite s,sx,sy,si
endif
if sx>bsx then bsx=sx
if sx<ssx then ssx=sx
next s
lin=5
endif
if lin=5 and time+speed+((speed/5)*4)<timer()
for s=45 to 55
if sprite exist(s)=1
sx=Sprite x(s) : sy=Sprite y(s): si=sprite image(s)
sx=sx+Move
if drop=1 then sy=sy+8
si=si+toggle
sprite s,sx,sy,si
endif
if sx>bsx then bsx=sx
if sx<ssx then ssx=sx
next s
lin=1 : drop=0
time=timer()
endif
endif
if lin=1
if bsx>210 then drop=1:move=-2 :bsx=50
if ssx<2 then drop=1:move=2 :ssx=50
endif
`sauser
if rnd(3000)=1 and sprite exist(56)=0 then
if rnd(2)=1
sprite 56,0,40,7 :sausx#=0 : sausdir#=0.75
else
sprite 56,260,40,7 :sausx#=260 : sausdir#=-0.75
endif
if sprite exist(56)=1
if timer() >pltime+29 then sausx#=sausx#+sausdir#
sprite 56,sausx#,40,7
if sausx#> 260 or sausx#<0 then delete sprite 56
endif
`invader shoot
if invadershot1=0
if rnd(10000)<(playlevel+1)*100
repeat
inv=rnd(54)+1
until sprite exist(inv)=1
insx= sprite x(inv):insy=sprite y(inv)
sprite 1001, insx+4,insy,10
invadershot1=1
endif
else
insy=sprite y(1001) : insx=sprite x(1001)
if timer() >inshtime+30-playlevel
sprite 1001, insx,insy+1,10
mirror sprite 1001
if insy>240 then delete sprite 1001: invadershot1=0
inshtime=timer()
endif
endif
if in2vadershot=0
if rnd(10000)<(playlevel+1)*100
repeat
inv=rnd(54)+1
until sprite exist(inv)=1
insx= sprite x(inv):insy=sprite y(inv)
sprite 1002, insx+4,insy,10
in2vadershot=1
endif
else
insy=sprite y(1002): insx=sprite x(1002)
if timer() >in2shtime+20-playlevel
sprite 1002, insx,insy+1,10
mirror sprite 1002
if insy>240 then delete sprite 1002: in2vadershot=0
in2shtime=timer()
endif
endif
`invader shot hit
for laser=1001 to 1002
`hit bunkers
invhitted=0
if sprite exist (laser)=1
invhitted=sprite collision(laser,0)
if invhitted>99 and invhitted<104
`demolish bunker
shotx=sprite x(laser): shoty=sprite y(laser)
set current bitmap 1
if point (shotx,shoty)=46080 or point (shotx+1,shoty) or point (shotx-1,shoty)
ink rgb(0,0,0),rgb(0,0,0)
line shotx,shoty,shotx,shoty+6
line shotx-1,shoty,shotx-1,shoty+8
line shotx+1,shoty,shotx+1,shoty+6
for temp=1 to 20+rnd(10)
dot shotx+rnd(8)-4,shoty+rnd(8)
NEXT temp
delete sprite laser
if laser=1002 then in2vadershot=0
if laser=1001 then invadershot1=0
gosub DrawBunkers
ink rgb(255,255,255),rgb(0,0,0)
endif
set current bitmap 0
ENDIF
`hitshot
if invhitted = 70
delete sprite 70
pl1fire=0
if rnd(1)=0
delete sprite laser
if laser=1002 then in2vadershot=0
if laser=1001 then invadershot1=0
endif
endif
`hit player
if invhitted=59
delete sprite laser
sprite 2001,sprite x(59),sprite y(59),14
if laser=1002 then in2vadershot=0
if laser=1001 then invadershot1=0
if sprite exist(57)then delete sprite 57
if sprite exist(58)then delete sprite 58
if sprite exist(59)then delete sprite 59
pl1x=0 :playexpl=1
lives=lives-1
gosub drawplayer
endif
endif
next laser
`check aliens have landed
for temp=1 to 55
if sprite exist(temp)=1
invay= sprite y(temp)
if invay > maxinvy then maxinvy=invay
if maxinvy>225 then lives=0
ENDIF
NEXT
`players
if keystate(57)=0 then letgo=0
if timer() >pltime+30
`player1
if KEYSTATE(30)=1 or keystate (203)=1 then pl1x=pl1x-1
if keystate(32)=1 or keystate (205)=1 then pl1x=pl1x+1
if pl1x<10 then Pl1x=10
if pl1x>200 then pl1x=200
if keystate(57)=1 and pl1fire=0 and letgo=0 and sprite exist(2000)=0 then pl1fire=1 :letgo=1
pltime=timer()
endif
sprite 59,pl1x,230,8
if pl1fire=1
if sprite exist(70)=0
sprite 70,pl1x+7,230,9
else
if timer()>pl1firetime
move sprite 70,2
if sprite y(70)<20 then delete sprite 70 : pl1fire=0
if sprite exist(70)=1
hitted=sprite collision(70,0)
`hit invader and sauser
if hitted<57 and hitted>0
`score
if sprite image(hitted)<3 then score=score+30
if sprite image(hitted)=3 or sprite image(hitted)=4 then score=score+20
if sprite image(hitted)=5 or sprite Image(hitted)=6 then score=score+10
if sprite image(hitted)=7
sausamount=(rnd(2)+1)*100
sausex=sprite x(hitted)
score=score+Sausamount
sausetimer=100
endif
sprite 2000,sprite x(hitted)+2,sprite y(hitted)+2,12
plexsz=1
size sprite 2000,plexsz,plexsz
if hitted<56 then invadersleft=invadersleft-1 :speed=speed-10 :pl1fire=0
delete sprite hitted :delete sprite 70
endif
if sausetimer>0
center text sausex,30,str$(sausamount)
dec sausetimer
endif
`hit bunker
if hitted>99 and hitted<104
`demolish bunker
shotx=sprite x(70): shoty=sprite y(70)-1
set current bitmap 1
if point (shotx,shoty)=46080
ink rgb(0,0,0),rgb(0,0,0)
line shotx,shoty-4,shotx,shoty+2
line shotx-1,shoty-4,shotx-1,shoty+2
line shotx+1,shoty-4,shotx+1,shoty+2
for temp=1 to 20+rnd(10)
dot shotx+rnd(8)-4,shoty-rnd(8)
NEXT temp
delete sprite 70 : pl1fire=0
gosub DrawBunkers
ink rgb(255,255,255),rgb(0,0,0)
endif
set current bitmap 0
endif
endif
pl1firetime=timer()
`endif
endif
endif
endif
if sprite exist(2000)
inc plexsz
size sprite 2000,plexsz,plexsz
sprite 2000,sprite x(2000)+0.25,sprite y(2000)+0.5,12
if plexsz=12
delete sprite 2000
plexsz=0
pl1fire=0
endif
endif
`new level
if invadersleft=0
gosub Drawinvaders
playlevel=playlevel+1
endif
text 8,1,"SCORE<1> HI-SCORE SCORE<2>"
if score=0 then score$="000"+str$(score)
if score<100 and score>0 then score$="00"+str$(score)
if score<1000 and score>100 then score$="0"+str$(score)
if score>1000 then score$=str$(score)
if score>hiscore then hiscore=score
hiscore$=str$(hiscore)
text 16,15,score$ : text 90,15,Hiscore$
line 0,245,224,245
text 8,245,str$(lives) : text 140,245,"CREDIT 99"
sync
until lives=0
paste image 13,0,0
center text 100,50,"* GAME OVER *"
sync
wait 1000
for deltemp=1 to 2000
if sprite exist(deltemp)then delete sprite deltemp
NEXT
loop
STARTSCREEN:
cls
gosub drawplayer
starttime=timer()
repeat
`background
paste image 13,0,0
text 8,1,"SCORE<1> HI-SCORE SCORE<2>"
if score=0 then score$="000"+str$(score)
if score<100 and score>0 then score$="00"+str$(score)
if score<1000 and score>100 then score$="0"+str$(score)
if score>1000 then score$=str$(score)
text 16,15,score$ : text 90,15,Hiscore$
text 8,245,str$(lives) : text 140,245,"CREDIT 99"
center text 112,40, "PLAY"
center text 112,60, "SPACE INVADERS"
center text 112,80, "by"
center text 112,100, "Jammy-Soft"
center text 112,150, "PUSH"
center text 112,175, "ONLY 1PLAYER BUTTON"
sync
until keystate(2)=1
lives=3 : score=0: level=0 :in2vadershot=0: invadershot1=0 : lev=0
speed=600 : lin=1 :move=2 :drop=0 : ssx=50 :pltime=timer():pl1firetime=timer()
return
drawPlayer:
if playexpl=1
for temp = 1 to 10
if sprite visible(2001)=1 then hide sprite 2001 else show sprite 2001
paste image 13,0,0
text 8,1,"SCORE<1> HI-SCORE SCORE<2>"
if score=0 then score$="000"+str$(score)
if score<100 and score>0 then score$="00"+str$(score)
if score<1000 and score>100 then score$="0"+str$(score)
if score>1000 then score$=str$(score)
text 16,15,score$ : text 90,15,Hiscore$
line 0,245,224,245
text 8,245,str$(lives) : text 140,245,"CREDIT 99"
sync
wait 100
NEXT temp
playexpl=0 :delete sprite 2001
endif
s=57
if lives>1
for play=1 to lives-1
sprite s,20*play,250,8 :inc s
next play
endif
`sprite s,0,225,8:inc s
return
DrawBunkers:
set current bitmap 1
for bunker=1 to 4
get image 99+bunker,(50*bunker)-25,200,(50*bunker),226,1
next bunker
set current bitmap 0
for bunker=1 to 4
sprite 99+bunker,(50*bunker)-25,200,99+bunker
NEXT bunker
return
Drawinvaders:
q=9: invadersleft=55
`invaders
for i=1 to 55
paste image 13,0,0
q=q+16
if 1<12
sprite i,q,120+lev,5
endif
if i>11 and i<23
if i=12 then q=25
sprite i,q,105+lev,5
endif
if i>22 and i<34
if i=23 then q=25
sprite i,q,90+lev,3
endif
if i>33 and i<45
if i=34 then q=25
sprite i,q,75+lev,3
endif
if i>44 and i<56
if i=45 then q=25
sprite i,q,60+lev,1
endif
sync
wait 20
NEXT
toggle=-1 : lin=1
if playlevel<4 then lev=lev+15
speed=560
return
`invader 1
data 6,7,0,5,6,7,8,0,4,5,6,7,8,9,0,3,4,6,7,9,10,0,3,4,5,6,7,8,9,10,0,5,8,0,4,6,7,9,0,3,5,8,10,98
data 6,7,0,5,6,7,8,0,4,5,6,7,8,9,0,3,4,6,7,9,10,0,3,4,5,6,7,8,9,10,0,4,6,7,9,0,3,10,0,4,9,98
`invader 2
data 3,10,0,1,4,9,12,0,1,3,4,5,6,7,8,9,10,12,0,1,2,3,5,6,7,8,10,11,12,0,1,2,3,4,5,6,7,8,9,10,11,12,0,2,3,4,5,6,7,8,9,10,11,0,3,10,0,2,11,98
data 3,10,0,4,9,0,3,4,5,6,7,8,9,10,0,2,3,5,6,7,8,10,11,0,1,2,3,4,5,6,7,8,9,10,11,12,0,1,3,4,5,6,7,8,9,10,12,0,1,3,10,12,0,4,5,8,9,98
`invader 3
data 5,6,7,8,0,2,3,4,5,6,7,8,9,10,11,0,1,2,3,4,5,6,7,8,9,10,11,12,0,1,2,3,6,7,10,11,12,0,1,2,3,4,5,6,7,8,9,10,11,12,0,4,5,8,9,0,3,4,6,7,9,10,0,1,2,11,12,98
data 5,6,7,8,0,2,3,4,5,6,7,8,9,10,11,0,1,2,3,4,5,6,7,8,9,10,11,12,0,1,2,3,6,7,10,11,12,0,1,2,3,4,5,6,7,8,9,10,11,12,0,3,4,5,8,9,10,0,2,3,6,7,10,11,0,3,4,9,10,98
`bonus ship
data 6,7,8,9,10,11,0,4,5,6,7,8,9,10,11,12,13,0,3,4,5,6,7,8,9,10,11,12,13,14,0,2,3,5,6,8,9,11,12,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,0,3,4,5,8,9,12,13,14,0,4,13,98
`player
data 8,0,7,8,9,0,7,8,9,0,2,3,4,5,6,7,8,9,10,11,12,13,14,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,98
`shots
data 2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,98
data 2,0,2,0,3,0,2,0,1,0,2,0,2,98
`bunker
data 6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,0,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,0,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,0,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,0,1,2,3,4,5,6,7,8,16,17,18,19,20,21,22,23,24,25,26,0,1,2,3,4,5,6,7,17,18,19,20,21,22,23,24,25,26,0,1,2,3,4,5,6,18,19,20,21,22,23,24,25,26,0,1,2,3,4,5,6,18,19,20,21,22,23,24,25,26,0,1,2,3,4,5,6,18,19,20,21,22,23,24,25,26,98
`explosions
`shot
data 1,4,7,0,2,4,6,0,3,5,0,1,2,6,7,0,3,5,0,2,4,6,0,1,4,7,98
`ship
data 0,7,9,0,8,9,0,2,4,6,8,9,10,12,14,0,1,2,4,6,7,8,10,11,13,14,0,2,4,5,6,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,98
`exit
data 99
press "1" to start
Arrowkeys to move
"space" to fire
Unfortunately, I have not had much time this month. So this has been made with every 5 mins I have had spare. I had wanted to add sound, two player mode, optimize, polish and play test on other machines; however I have no time for that.
Screenshot
I know it is not good enough to win, but I have had fun, and it has taken me back to the early 1980s, spending my pocket money on the arcade machines in my local bowling alley.
Perhaps you will host other competitions James featuring the other greats like Packman, Defender, Robotron, Phoenix, and my personal favourite Missile Command.
However whatever the next competition is, I look forward to it and hope to have a better entry.
Goodluck everyone.