'*******************
'* PF BLOCK-BUSTER *
'* --------------- *
'* by:H.K.02/16/91 *
'*   Have fun!!    *
'*   Thanks to:    *
'*  B.J. GLEASON   *
'* for PBASIC 4.1  *
'*******************

   dim h(4,22)
   dim s$(1)
   
1  cls
   gosub 12
   gosub 30
   scrsave s$(0)
   errwin 3,18,"Use arrow keys"
   errwin 3,17,"Use [Esc] to quit"
   scrload s$(0)

  'MAIN LOOP ROUTINE
10 gosub 20:gosub 25:gosub 20
   if yb<7 then 11
   gosub 28:gosub 20 
11 if yb>4 then 10  
   gosub 35:gosub 20:goto  10

  'INITIALIZE VARIABLES
12 p$="  "+string$(4,223)+"  "
   ball$=chr$(2):locate 8,22,0:? p$;
   xmv=1:ymv=1:x=22:a$=" ":blf=5
   xb=22:yb=5:score=0:sa=1
   box 1,1,8,13,1
   locate 2,2,0:?"PBASIC v4.1"
   locate 3,2,0:?"BLOCKBUSTER"
   locate 4,2,0:?"-----------"
   locate 5,2,0:?"Score: 0   "
   locate 6,2,0:?"Balls: 5   "
   locate 7,2,0:?"Block: 0   "
   return

  'SCORE & BALL CONTROL
15 if blf=0 or sa=32 then errwin 3,20,"Game-over!":goto 1
   locate 5,9,0:? score:locate 6,9,0:? blf:locate 7,9,0:? sa:return

  'PLAYER DISPLAY & MOVEMENT
20 a$=inkey$:if a$="" then return 
   if a$=chr$(27) then locate 1,1,2:cls:end
   if a$=chr$(75) and x>15 then x=x-2
   if a$=chr$(77) and x<32 then x=x+2
   locate 8,x,0:? p$;:return

  'BALL DISPLAY & MOVEMENT
25 oyb=yb:oxb=xb
   xb=xb+xmv:if xb>36 or xb<18 then xmv=xmv*(-1)
   yb=yb+ymv:if yb>7 or yb<2 then ymv=ymv*(-1)
   locate oyb,oxb,0:?" ";:locate yb,xb,0:? ball$;
   return

  'BALL BOUNCE ON PLAYER
28 if yb=8 then blf=blf-1:gosub 15:beep
   if xb=x+2 or xb=x+3 then ymv=-1:xmv=-1:click:return
   if xb=x+4 or xb=x+5 then ymv=-1:xmv=1:click:return
   return   

  'MAKE BRICKS
30 for f=2 to 4:for k=17 to 37 step 2
   if f*k=111 then 31
   if f=3 then locate f,k+1,0:h(f-2,k-16)=1
   if f<>3 then locate f,k,0:h(f-2,k-17)=1
   ? chr$(223);:?" ";
31 next k:?:next f:return
   
35 'BALL HITS BRICK
   if xb<17 then return
   if yb<2 then return
   if h(yb-2,xb-17)=1 then h(yb-2,xb-17)=0:ymv=ymv*(-1):score=score+sa:sa=sa+1:gosub 15:if yb=3 then xmv=xmv*(-1)
   return
                                                                        