Как написать игру для ZX Spectrum на ассемблере


         

Программа БИТВА С НЛО - часть 3


; Далее следуют уже описанные процедуры прерывания

А вот бейсик-программа самой игры:

10 REM *** НЛО *** 20 BORDER 0: PAPER 0: INK 7: CLEAR 59999 30 RANDOMIZE USR 15619 : REM : LOAD "snd_ufo"CODE 40 LET cd=USR 60021: REM *** UDG *** 50 LET cd=USR 60000: REM *** Прерывания *** 60 REM -------------- 70 CLS 80 FOR n=19 TO 20: PRINT AT n,0; PAPER 4; TAB 31;" ": NEXT n 90 FOR n=0 TO 18: PRINT AT n,0; PAPER 4;" ";AT n,31;" ": NEXT n 100 LET kl=0: LET ik1=7: LET ik2=ik1: LET pow=0: LET pow1=pow: LET x1=4: LET y1=1: LET w=0: LET xp=0: LET yp=0: LET s1=10: LET s=10: LET x=4: LET y=1 110 LET a$=INKEY$ 120 IF a$="p" AND s<28 THEN LET s=s+1: GO TO 180 130 IF a$="o" AND s>1 THEN LET s=s-1: GO TO 190 140 IF a$=" " THEN LET cd=USR 60006: GO TO 230 150 IF a$="e" THEN LET cd=USR 60003: STOP 160 REM -------------- 170 GO TO 200 180 PRINT AT 17,s1;" ";AT 18,s1;" ": GO TO 200 190 PRINT AT 17,s1+2;" ";AT 18,s1+2;" " 200 INK 6: PRINT AT 17,s;"EFG";AT 18,s;"HIJ" 210 LET s1=s 220 LET ik2=7: GO TO 280 230 IF INT x=s OR INT x+1=s THEN LET yy=INT y+1: LET pow1=pow1+1: LET cd=USR 60015: LET ik2=2: GO TO 250 240 LET yy=0 250 GO SUB 270: OVER 1: GO SUB 270: OVER 0 260 GO TO 280 270 INK 7: PLOT s*8+5,41: DRAW 0,126-yy*8: RETURN 280 REM ----- нло ---- 290 IF w=0 THEN LET xp= (RND*1.5+.5): LET yp= (RND*1.5): LET w=INT (RND*25+5): LET xp=xp*SGN (RND*4-2): LET yp=yp*SGN (RND*4-2) 300 IF x+xp>=1 AND x+xp<30 AND y+yp>=0 AND y+yp<=12 AND w>0 THEN LET x=x+xp: LET y=y+yp: LET w=w-1: LET kl=0: GO TO 330 310 IF ((INT (x+xp)<1 AND INT x=1) OR (INT x=29 AND INT (x+xp)>29)) AND kl=0 THEN LET kl=1: LET cd=USR 60018 320 LET w=0: GO TO 290 330 PRINT AT INT y1,INT x1;"··";AT INT y1+1,INT x1;"··" 340 INK 5: PRINT AT INT y,INT x;"AB";AT INT y+1,INT x;"CD" 350 LET x1=x: LET y1=y 360 IF RND*10<3 THEN LET cd=USR 60012: LET xf=RND*255: GO SUB 410: OVER 1: GO SUB 410: OVER 0: LET xf1=INT (xf/8): IF xf1=s OR xf1=s+1 OR xf1=s+2 THEN LET pow=pow+1: LET cd=USR 60009: LET ik1=2: GO TO 380 370 LET ik1=7 380 PRINT AT 21,1; INK ik2;"Score car:";INT pow1;" " 390 PRINT AT 21,19; INK ik1;"Score ufo:";INT pow;" " 400 GO TO 110 410 INK 2: PLOT INT (x)*8+7,159-INT (y)*8: DRAW xf-(INT (x)*8+7),25-(159-INT (y)*8): RETURN




Содержание  Назад  Вперед