Classic Computer Magazine Archive PROGRAM LISTING: 85-07/DARKSTAR.ACT


; DARKSTAR, LISTING 1
; BY MICHAEL MITCHELL
; (c) 1985, ANTIC PUBLISHING

BYTE WSYNC=54282,VCOUNT=54283,
     CLR=53274,CTR,CLR1=53270,
     CHGCLR=[0],INCCLR1,S,INCCLR,  
     CLR2=53271,A,B
CARD ML,SC,SP,Q,I

PROC WAIT(CARD N); MAIN DELAY
 FOR I=0 TO N+N
 DO OD 
RETURN
   
PROC TITLE()   ; PRINT TITLE AND 
SC=0  ML=0     ; SCROLL THE COLORS
GRAPHICS(2+16)
POSITION(5,2)
 PRINTDE(6,"dArKsTaR")
POSITION(8,4)
 PRINTDE(6,"By")
POSITION(1,6)
 PRINTDE(6," MiChAeL mItChElL")    
POSITION(0,09) 
 PRINTDE(6,"pReSs FiRe To BeGiN!")
DO
 FOR CTR=1 TO 10   
 DO
  INCCLR=CHGCLR INCCLR1=CHGCLR
  DO
   S=STRIG(0)
   IF S=0 THEN RETURN FI
   WSYNC=0
   CLR=INCCLR CLR1=INCCLR1
   CLR2=INCCLR+10
   INCCLR==+1 INCCLR1==-1
   UNTIL VCOUNT&128
  OD
 OD   
 CHGCLR==+1
OD    

PROC BOX()   ; DRAWS THE ENEMY
A=RAND(150)+3  B=RAND(74)+3 COLOR=1
PLOT(A,B)
DRAWTO(A+2,B) DRAWTO(A+2,B+2)
DRAWTO(A,B+2) DRAWTO(A,B)
RETURN

PROC MAIN() ;  THE MAIN ROUTINE
INT XX=[1],YY=[0],SS,X,Y,Q
BYTE Z,E,E1,A1,B1,D,C=[0]
BYTE A,B  
X=50 Y=50
 
GRAPHICS(7) COLOR=2 ; DRAW BORDER
SNDRST() 
PLOT(1,1)
DRAWTO(158,1) DRAWTO(158,79)
DRAWTO(1,79) DRAWTO(1,1)
BOX()
       ; LOOK FOR COLLISION
DO
 Z=LOCATE(X,Y)
 IF Z=1 THEN    ; ENEMY HAS BEEN HIT
  FOR E=1 TO 20
  DO WAIT(50) SOUND(0,E,08,10)
  SETCOLOR(2,E,10)  
  OD
  SNDRST() BOX()
  SC==+10 SETCOLOR(2,0,0)
 FI
 IF Z=2 THEN    ; YOU HAVE BEEN HIT
 FOR D=1 TO 35
 DO COLOR=C
  SOUND(0,D,8,10) C==+1
  SETCOLOR(2,D,C) SETCOLOR(0,C,D)
  SETCOLOR(1,A1,B1)
  IF C=4 THEN C=1 FI
  A1=RAND(153) B1=RAND(78) PLOT(X,Y)
  DRAWTO(A1,B1)
 OD
 ML==+1  SNDRST()
  IF ML>2 THEN  ; CHECK FOR MEN LEFT
   ML=0 GRAPHICS(2+16)
   POSITION(4,4)
   PRINTD(6,"GAME OVER")
   POSITION(4,5)
   PRINTD(6,"SCORE: ") PRINTBDE(6,SC)
   FOR X=0 TO 242 STEP 2
   DO
    WAIT(500) SOUND(0,X+1,10,10)
    SOUND(1,X+2,10,10)
    SOUND(2,X+3,10,10)
    SOUND(3,X+4,10,10)
    SETCOLOR(0,X,10)
   OD
   WAIT(32000)   ; DELAY
   SC=0 TITLE()
   FI
  MAIN()
 FI

 Q==+1 SETCOLOR(1,Q,14)
 COLOR=2 PLOT(X,Y)
 SS=STICK(0)   ; READ THE JOYSTICK
  IF SS=14 THEN XX=0  YY=-1
  ELSEIF SS=13 THEN XX=0 YY=1
  ELSEIF SS=11 THEN XX=-1 YY=0
  ELSEIF SS=7 THEN XX=1 YY=0
  FI 
 WAIT(350)  ; CHANGE WAIT VALUE FOR
            ; FASTER OR SLOWER SPEEDS
 X==+XX Y==+YY
 POKE(53279,5) ; KEYBOARD SOUND 
OD
RETURN

PROC START()                 
 TITLE()
 MAIN()








Back to previous page