Advertisement
przemko

Invaders from Outer Space

Dec 7th, 2024 (edited)
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PureBasic 3.04 KB | Source Code | 0 0
  1. 1000 REM INVADERS FROM OUTER SPACE
  2. 1002 GRAPHICS 5
  3. 1004 POKE 53277,0
  4. 1006 POKE 752,1
  5. 1008 ?
  6. 1009 ? " INVADERS FROM OUTER SPACE"
  7. 1010 ? " (C) PRZEMYSLAW KOBYLANSKI 2024"
  8. 1020 GOSUB 7000:REM PANORAMA
  9. 1030 GOSUB 9000:REM BITMAPS
  10. 1040 GOSUB 8000:REM P/M GRAPHICS
  11. 1045 ENABLE=0
  12. 1047 VISIBLE=0
  13. 1050 REM MAIN LOOP
  14. 1060 GOSUB 2000:REM INVADERS
  15. 1070 GOSUB 3000:REM UFO
  16. 1080 GOTO 1050
  17. 2000 REM INVADERS
  18. 2010 FOR I=0 TO 2
  19. 2020 IF I>0 THEN 2070
  20. 2030 X1=X(0)+DX(0)
  21. 2040 IF X1<48 OR X1>X(1)-8 THEN DX(0)=-DX(0)
  22. 2050 X(0)=X(0)+DX(0)
  23. 2060 GOTO 2150
  24. 2070 IF I<2 THEN 2120
  25. 2080 X1=X(2)+DX(2)
  26. 2090 IF X1<X(1)+8 OR X1>200 THEN DX(2)=-DX(2)
  27. 2100 X(2)=X(2)+DX(2)
  28. 2110 GOTO 2150
  29. 2120 X1=X(I)+DX(I)
  30. 2130 IF X1<X(I-1)+8 OR X1>X(I+1)-8 THEN DX(I)=-DX(I)
  31. 2140 X(I)=X(I)+DX(I)
  32. 2150 NEXT I
  33. 2160 FOR I=0 TO 2
  34. 2170 MOD=X(I)-2*INT(X(I)/2)
  35. 2180 POKE 53248+I,X(I)
  36. 2190 FOR J=0 TO 7
  37. 2200 POKE PB(I)+64+J,BM(MOD,J)
  38. 2210 NEXT J
  39. 2220 NEXT I
  40. 2230 SOUND 0,150,15,100
  41. 2240 FOR D=1 TO 6
  42. 2250 NEXT D
  43. 2260 SOUND 0,0,0,0
  44. 2270 RETURN
  45. 3000 REM UFO
  46. 3010 IF ENABLE THEN 3050
  47. 3020 ENABLE=RND(1)<0.02
  48. 3030 IF NOT (ENABLE) THEN RETURN
  49. 3040 VISIBLE=0
  50. 3050 IF VISIBLE THEN 3130
  51. 3060 DX(3)=3-6*INT(2*RND(1))
  52. 3070 X(3)=32+176*(DX(3)<0)
  53. 3075 POKE 53251,X(3)
  54. 3080 FOR I=0 TO 7
  55. 3090 POKE PB(3)+15+I,BM(2,I)
  56. 3100 NEXT I
  57. 3110 VISIBLE=1
  58. 3115 SOUND 1,80,2,3
  59. 3120 RETURN
  60. 3130 X(3)=X(3)+DX(3)
  61. 3140 IF DX(3)>0 THEN 3220
  62. 3150 IF X(3)>31 THEN 3300
  63. 3160 FOR I=0 TO 7
  64. 3170 POKE PB(3)+15+I,0
  65. 3180 NEXT I
  66. 3190 VISIBLE=0
  67. 3200 0
  68. 3200 ENABLE=0
  69. 3205 SOUND 1,0,0,0
  70. 3210 RETURN
  71. 3220 IF X(3)<209 THEN 3300
  72. 3230 GOTO 3160
  73. 3300 POKE 53251,X(3)
  74. 3310 RETURN
  75. 7000 REM PANORAMA
  76. 7002 H1=0
  77. 7004 H2=10
  78. 7006 H3=20
  79. 7010 FOR X=0 TO 79
  80. 7020 COLOR 3
  81. 7030 PLOT X,H1
  82. 7040 DRAWTO X,47
  83. 7050 COLOR 2
  84. 7060 PLOT X,H2
  85. 7070 DRAWTO X,47
  86. 7080 COLOR 1
  87. 7090 PLOT X,H3
  88. 7100 DRAWTO X,47
  89. 7110 H=H1+1-2*INT(2*RND(1))
  90. 7120 IF H<0 OR H>23 THEN 7110
  91. 7125 H1=H
  92. 7130 H=H2+1-2*INT(2*RND(1))
  93. 7140 IF H<10 OR H>20 THEN 7130
  94. 7145 H2=H
  95. 7150 H=H3+1-2*INT(2*RND(1))
  96. 7160 IF H<15 OR H>20 THEN 7150
  97. 7165 H3=H
  98. 7170 NEXT X
  99. 7180 RETURN
  100. 8000 REM P/M GRAPHICS
  101. 8005 POKE 53277,0
  102. 8010 TOP=156
  103. 8020 POKE 106,TOP
  104. 8030 PB=TOP*256
  105. 8040 POKE 54279,TOP
  106. 8050 POKE 559,46:REM DOUBLE
  107. 8060 POKE 623,1:REM PRIORITY
  108. 8080 POKE 53256,0
  109. 8085 DIM X(3),PB(3),DX(3)
  110. 8090 FOR I=0 TO 3
  111. 8095 POKE 704+I,101+3*I:REM COLOR
  112. 8100 POKE 53256+I,0:REM NORMAL SIZE
  113. 8110 X(I)=48+I*38+INT(38*RND(1))
  114. 8115 DX(I)=1+2*I-(2+4*I)*INT(2*RND(1))
  115. 8120 POKE 53248+I,X(I)
  116. 8130 PB(I)=PB+512+I*128
  117. 8150 NEXT I
  118. 8155 POKE 53259,1:REM DOUBLE SIZE
  119. 8160 FOR A=PB(0) TO PB(0)+1023
  120. 8170 POKE A,0
  121. 8180 NEXT A
  122. 8190 FOR I=0 TO 2
  123. 8200 MOD=X(I)-2*INT(X(I)/2)
  124. 8210 FOR J=0 TO 7
  125. 8220 POKE PB(I)+64+J,BM(MOD,J)
  126. 8230 NEXT J
  127. 8240 NEXT I
  128. 8250 POKE 53277,3
  129. 8260 RETURN
  130. 9000 REM BITMAPS
  131. 9010 DIM BM(3,7)
  132. 9020 FOR I=0 TO 1
  133. 9030 FOR J=0 TO 7
  134. 9040 READ V
  135. 9050 BM(I,J)=V
  136. 9060 NEXT J
  137. 9070 NEXT I
  138. 9080 FOR J=0 TO 7
  139. 9090 READ V
  140. 9100 BM(2,J)=V
  141. 9110 NEXT J
  142. 9120 RETURN
  143. 9200 DATA 24,60,126,219,126,60,66,36
  144. 9210 DATA 24,60,126,219,126,24,36,66
  145. 9220 DATA 0,0,60,126,219,255,90,0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement