Advertisement
Guest User

spctank_mod.bas

a guest
Aug 5th, 2013
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.20 KB | None | 0 0
  1. rem SPACE TANKS for the Atari VCS
  2. rem Geek Basic Computers 2013 www.geekbasic.com
  3. rem programmed by: Gemino Michael Smothers
  4.  
  5. set tv ntsc
  6. set romsize 4k
  7. set optimization noinlinedata
  8.  
  9. dim mapx=a
  10. dim mapy=b
  11. dim area=c
  12. dim object=d
  13. dim shield=e
  14. dim ammo=f
  15. dim anim=g
  16. dim dir=h
  17. dim aimx=i
  18. dim aimy=j
  19. dim delay=k
  20. dim shoot=l
  21. dim key=m
  22. dim kills=n
  23. dim chance=o
  24. dim tempx1=p
  25. dim tempy1=q
  26. dim tempx2=r
  27. dim tempy2=s
  28. dim sfx=t
  29. dim slen=u
  30. dim explode=v
  31. dim flag=w
  32. dim npcshield=x
  33. dim autolock=y
  34. dim bigmissile=z
  35.  
  36. dim P0plo = player0pointerlo
  37. dim P1plo = player1pointerlo
  38. dim P0x = player0x
  39. dim P0y = player0y
  40. dim P1x = player1x
  41. dim P1y = player1y
  42. dim M0x = missile0x
  43. dim M0y = missile0y
  44. dim M1x = missile1x
  45. dim M1y = missile1y
  46.  
  47. const p0_0 = $81
  48. const p0_1 = p0_0 + 8
  49. const p0_2 = p0_0 + 16
  50. const p1_0 = $99
  51. const p1_1 = p1_0 + 8
  52. const p1_2 = p1_0 + 16
  53. const p1_3 = p1_0 + 24
  54. const p1_4 = p1_0 + 32
  55. const p1_5 = p1_0 + 40
  56. const p1_6 = p1_0 + 48
  57. const p1_7 = p1_0 + 56
  58. const p1_8 = p1_0 + 64
  59. const p1_9 = p1_0 + 72
  60. const p1_A = p1_0 + 80
  61.  
  62.  
  63. ammo = 60 : shield = 60 : P0x = 45 : P0y = 45 : M0y = 45 : M0x = 55
  64.  
  65. gosub titlecols
  66.  
  67. flag=99
  68.  
  69. titleloop
  70.  
  71. flag = flag + 1
  72.  
  73. if flag = 100 then playfield:
  74. ......XXX..X...XX...XX...X.....
  75. .....X....X.X.X..X.X....X......
  76. ......XX..XX..XXXX.X....XX.....
  77. ........X.X...X..X.X....X......
  78. .....XXX..X...X..X..XX...X.....
  79. ...............................
  80. .....XXX..XX..X..X.X.X..XXX....
  81. ......X..X..X.XX.X.X.X.X.......
  82. ......X..XXXX.X.XX.XX...XX.....
  83. ......X..X..X.X..X.X.X....X....
  84. ......X..X..X.X..X.X.X.XXX.....
  85. end
  86.  
  87. if flag = 200 then playfield:
  88. .........XXX..X..X.X.X.........
  89. ........X....X..X..X.X.........
  90. ........X.XX.XX.XX.XX..........
  91. ........X..X.X..X..X.X.........
  92. .........XX...X..X.X.X.........
  93. ...............................
  94. ......XX...XX...XXX.XXX..XX....
  95. .....X..X.X..X.X.....X..X......
  96. .....X.XX.XXXX..XX...X..X......
  97. .....X..X.X..X....X..X..X......
  98. .....XXX..X..X.XXX..XXX..XX....
  99. end
  100.  
  101. if flag = 200 then flag = 0
  102.  
  103. if !joy0fire && !joy1fire then drawscreen : goto titleloop
  104.  
  105. gosub set_players
  106. area = 4
  107.  
  108. playfield:
  109. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  110. X..............................X
  111. X..............................X
  112. X..............................X
  113. X..............................X
  114. X..............................X
  115. X..............................X
  116. X..............................X
  117. X..............................X
  118. X..............................X
  119. XXXXXXXXXXXXX.....XXXXXXXXXXXXXX
  120. end
  121.  
  122. loadroom
  123.  
  124. flag = mapy * 10 + mapx
  125. area = area ^ areas[flag]
  126.  
  127. if area{0} then pfhline 13 0 17 flip
  128. if area{1} then pfvline 31 3 7 flip
  129. if area{2} then pfhline 13 10 17 flip
  130. if area{3} then pfvline 0 3 7 flip
  131.  
  132. area = areas[flag] : flag = 0
  133.  
  134. if mapx = 6 && mapy = 6 then object = 9 : goto gameloop else object = (rand & 15) + 1
  135. if object = 4 || object > 8 then object = 0
  136. if !mapx && !mapy then object = 0
  137. npcshield = object
  138.  
  139.  
  140. P1x = (rand & 110) + 20
  141. P1y = (rand & 60) + 20
  142.  
  143. gameloop
  144.  
  145. COLUPF = $00
  146. COLUBK = $E6
  147. COLUP0 = $04
  148.  
  149. if anim = 11 then anim = 0
  150.  
  151. if anim < 6 then P0plo = p0_0
  152. if anim > 5 then P0plo = p0_1
  153.  
  154. if P0y < 10 && mapy then mapy = mapy - 1 : P0y = 85 : goto loadroom
  155. if P0x > 135 && mapx < 9 then mapx = mapx + 1 : P0x = 20 : goto loadroom
  156. if P0y > 85 && mapy < 10 then mapy = mapy + 1 : P0y = 20 : goto loadroom
  157. if P0x < 15 && mapx then mapx = mapx - 1 : P0x = 130 : goto loadroom
  158.  
  159. if collision(player0,playfield) && dir then P0x = P0x + dx[dir] : P0y = P0y + dy[dir] : goto skipmove
  160.  
  161. if !explode && flag then flag = 0
  162. if flag = 1 then skipmove
  163.  
  164. temp1 = (SWCHA ^ $F0) / 16
  165. if temp1 && !collision(player0,playfield) then dir = dirt[temp1] : P0x = P0x - dx[dir] : P0y = P0y - dy[dir] : flag = 2 : anim = anim + 1
  166.  
  167. skipmove
  168.  
  169. if joy1up && M0y > 8 then M0y = M0y - 1
  170. if joy1right && M0x < 155 then M0x = M0x + 1
  171. if joy1down && M0y < 80 then M0y = M0y + 1
  172. if joy1left && M0x > 5 then M0x = M0x - 1
  173.  
  174. if autolock then M0x = P1x + 3 : M0y = P1y - 2
  175.  
  176. temp1 = object / 8 : temp2 = setb[object]
  177. if cP1f[temp1] & temp2 then COLUP1 = cP1[object]
  178. if NS1f[temp1] & temp2 then NUSIZ1 = NS1[object]
  179. if P1f[temp1] & temp2 then P1plo = P1[object]
  180. on object gosub o0 o1 o2 o3 o4 o5 o6 o7 o8 o9
  181.  
  182.  
  183. skipo
  184.  
  185. if joy0fire then tempx1 = P0x : tempy1 = P0y : tempx2 = P1x : tempy2 = P1y : goto huddisplay
  186.  
  187.  
  188. dead
  189.  
  190. if switchreset then reboot
  191.  
  192. drawscreen
  193.  
  194. AUDV0=0
  195.  
  196. if flag = 2 then AUDV0 = 4 : AUDC0 = 2 : AUDF0 = 3 : flag = 0
  197. if slen then AUDV0 = 10 : AUDC0 = 4 : AUDF0 = sfx : sfx = sfx - 1
  198. if slen && !sfx then sfx = 6 : slen = slen - 1
  199. if sfx > 0 && !slen then AUDV0 = 10 : AUDC0 = 8 : AUDF0 = 5 : sfx = sfx - 1
  200.  
  201. if shield > 250 then goto dead
  202.  
  203. goto gameloop
  204.  
  205. data areas
  206. 4, 6, 10, 10, 10, 12, 6, 10, 10, 12
  207. 5, 5, 6, 10, 10, 9, 5, 6, 12, 5
  208. 3, 15, 9, 2, 10, 10, 8, 5, 3, 9
  209. 6, 9, 6, 8, 6, 10, 12, 3, 10, 12
  210. 5, 6, 9, 2, 15, 12, 3, 10, 10, 9
  211. 5, 3, 12, 6, 15, 15, 8, 6, 10, 12
  212. 3, 12, 5, 5, 5, 3, 8, 3, 8, 5
  213. 2, 15, 15, 9, 3, 12, 6, 10, 10, 9
  214. 6, 15, 15, 12, 6, 9, 3, 10, 10, 12
  215. 6, 9, 1, 1, 6, 11, 11, 11, 11, 9
  216. end
  217.  
  218. data setb
  219. %00000001, %00000010, %00000100, %00001000, %00010000, %00100000, %01000000, %10000000
  220. %00000001, %00000010
  221. end
  222.  
  223. data cP1f
  224. %10011110, %000000011
  225. end
  226.  
  227. data cP1
  228. $48, $44, $0E, $12, $B8, $00, $00, $C2, $0A, $04
  229. end
  230.  
  231. data NS1f
  232. %10001110, %000000010
  233. end
  234.  
  235. data NS1
  236. $00, $00, $07, $07, $00, $00, $00, $00, $00, $07
  237. end
  238.  
  239. data P1f
  240. %10011111, %000000011
  241. end
  242.  
  243. data P1
  244. p1_A, p1_1, p1_2, p1_3, p1_4, p1_0, p1_0, p1_5, p1_6, p1_7
  245. end
  246.  
  247. data dirt
  248. 0, 1, 3, 1, 4, 1, 3, 1, 2, 1
  249. end
  250.  
  251. const dx = dy + 1
  252.  
  253. data dy
  254. 0, 1, 0, -1, 0, 1
  255. end
  256.  
  257.  
  258. o0
  259.  
  260. if explode then explode = explode - 1 : COLUP1 = $48 : P1plo = p1_0
  261. if !explode = 0 && flag = 1 then object = 4 : flag = 0
  262.  
  263. gosub hidemissile
  264.  
  265. return
  266.  
  267. o1
  268. o2
  269.  
  270. if joy1fire then gosub checkfire
  271.  
  272. if object = 2 then shoot = 0 : gosub hidemissile
  273.  
  274. delay = delay + 1
  275.  
  276. if object = 1 && delay < 3 then skipmove2
  277. if shoot then skipmove2
  278.  
  279. delay = 0
  280.  
  281. if aimy = 0 then P1y = P1y - 1
  282. if aimx = 1 then P1x = P1x + 1
  283. if aimy = 1 then P1y = P1y + 1
  284. if aimx = 0 then P1x = P1x - 1
  285.  
  286. skipmove2
  287.  
  288. if P1y < 20 then aimy = 1
  289. if P1x > 120 then aimx = 0
  290. if P1y > 80 then aimy = 0
  291. if P1x < 20 then aimx = 1
  292.  
  293. if collision(player0,player1) then shield = shield - 1 : sfx = 4
  294.  
  295. if object = 2 then return
  296.  
  297. if P0y = P1y && P0x < P1x && shoot = 0 then M1x = P1x + 4 : M1y = P1y - 3 : shoot = 1
  298. if P0y = P1y && P0x > P1x && shoot = 0 then M1x = P1x + 4 : M1y = P1y - 3 : shoot = 2
  299.  
  300. if shoot = 1 then M1x = M1x - 2
  301. if shoot = 2 then M1x = M1x + 2
  302.  
  303. if M1x < 20 || M1x > 135 then gosub hidemissile : shoot = 0
  304. if collision(player0,missile1) then shield = shield - 5 : shoot = 0 : sfx = 7 : gosub hidemissile
  305.  
  306. return
  307.  
  308.  
  309. o3
  310.  
  311. if joy1fire then gosub checkfire
  312.  
  313. delay = delay + 1
  314.  
  315. if delay < 3 then goto skipmove3
  316.  
  317. delay = 0
  318.  
  319. if P0y < P1y then P1y = P1y - 1
  320. if P0x > P1x then P1x = P1x + 1
  321. if P0y > P1y then P1y = P1y + 1
  322. if P0x < P1x then P1x = P1x - 1
  323.  
  324. skipmove3
  325.  
  326. if collision(player0,player1) then shield = shield - 1 : sfx = 2
  327.  
  328. return
  329.  
  330.  
  331. o4
  332.  
  333. if collision(player0,player1) then object = 0 : key = key + 1 : slen = 3 : sfx = 6
  334.  
  335. return
  336.  
  337.  
  338. o5
  339.  
  340. gosub hidemissile
  341. gosub shieldsprite
  342. if collision(player0,player1) then object = 0 : shield = shield + 15 : slen = 3 : sfx = 6
  343. if shield > 200 then shield = 200
  344.  
  345. return
  346.  
  347.  
  348. o6
  349.  
  350. gosub hidemissile
  351. gosub ammosprite
  352. if collision(player0,player1) then object = 0 : ammo = ammo + 10 : slen = 3 : sfx = 6
  353. if ammo > 200 then ammo = 200
  354.  
  355. return
  356.  
  357. o7
  358.  
  359. if collision(player0,player1) then object=0 : autolock = 3 : slen = 3 : sfx = 6
  360.  
  361. return
  362.  
  363. o8
  364.  
  365. if collision(player0,player1) then object = 0 : bigmissile = 3 : slen = 3 : sfx = 6
  366.  
  367. return
  368.  
  369. o9
  370.  
  371. P1x = 45
  372. P1y = 30
  373.  
  374. if collision(player0,player1) && key = 3 then goto win
  375.  
  376. return
  377.  
  378.  
  379. huddisplay
  380.  
  381. gosub shieldsprite
  382.  
  383. P0x=30 : M0x=40 : P0y=80 : M0y=80
  384. missile0height = shield
  385.  
  386. gosub ammosprite
  387.  
  388. P1x=50 : M1x=60 : P1y=80 : M1y=80
  389. missile1height = ammo
  390.  
  391. drawscreen
  392.  
  393. if joy0fire then goto huddisplay
  394.  
  395. P0x = tempx1
  396. P0y = tempy1
  397. P1x = tempx2
  398. P1y = tempy2
  399.  
  400. gosub hidemissile
  401. goto gameloop
  402.  
  403.  
  404. titlecols
  405.  
  406. COLUPF = $46
  407. COLUBK = $00
  408. scorecolor = $00
  409.  
  410. return
  411.  
  412. shieldsprite
  413.  
  414. COLUP1 = $86
  415.  
  416. P1plo = p1_8
  417.  
  418. if joy0fire then COLUP0 = $86 : P0plo = p0_2
  419.  
  420. return
  421.  
  422. ammosprite
  423.  
  424. COLUP1 = $44 : P1plo = p1_9
  425. return
  426.  
  427. hidemissile
  428.  
  429. missile0height = 0 : missile1height = 0 : M1x = 0 : M1y = 0
  430. return
  431.  
  432. checkfire
  433.  
  434. if ammo > 0 then ammo = ammo - 1 : sfx = 25 else goto skipfire
  435. if !collision(missile0,player1) then goto skipfire
  436. if npcshield && !bigmissile then npcshield = npcshield - 1 : goto skipfire
  437. if npcshield && bigmissile then npcshield = 0
  438. if key < 3 then kills = kills + 1
  439. if kills > 10 then flag = 1 : kills = 0 : score = score + 500
  440. if object <> 4 then score = score + 100
  441. if autolock then autolock = autolock - 1
  442. if bigmissile then bigmissile = bigmissile - 1
  443.  
  444. explode = 25
  445. object = 0
  446.  
  447. skipfire
  448.  
  449. return
  450.  
  451. win
  452.  
  453. gosub titlecols
  454. P0y = 0 : P1y = 0
  455.  
  456. playfield:
  457. ..X.X..X..XXX..XXX.X..XX..X..X.
  458. .X.X.X.X.X....X....X.X..X.XX.X.
  459. .X.X.X.X..XXX..XX..X.X..X.X.XX.
  460. .X.X.X.X....X....X.X.X..X.X..X.
  461. .X.X.X.X.XXX..XXX..X..XX..X..X.
  462. ...............................
  463. .XX..XX...X.X...X..X...X.XXX..X
  464. X...X..X.X.X.X.X.X.X..X...X..X.
  465. X...X..X.X.X.X.XX..X..XX..X..XX
  466. X...X..X.X.X.X.X...X..X...X..X.
  467. .XX..XX..X.X.X.X...XX..X..X...X
  468. end
  469.  
  470. if switchreset then reboot
  471.  
  472. drawscreen
  473.  
  474. goto win
  475.  
  476. set_players
  477.  
  478. player0:
  479. %10101011
  480. %01010101
  481. %11111111
  482. %11111111
  483. %01111110
  484. %00011000
  485. %01111000
  486. %00000000
  487. %11010101
  488. %10101010
  489. %11111111
  490. %11111111
  491. %01111110
  492. %00011000
  493. %01111000
  494. %00000000
  495. %00000000
  496. %00111000
  497. %01000100
  498. %00000100
  499. %00111000
  500. %01000000
  501. %01000100
  502. %00111000
  503. end
  504.  
  505. player1:
  506. %00000100
  507. %01111110
  508. %11111100
  509. %01111110
  510. %00111110
  511. %11111110
  512. %00111100
  513. %01011110
  514. %01100110
  515. %00100100
  516. %00011000
  517. %00011000
  518. %01111110
  519. %11011000
  520. %00111100
  521. %00111100
  522. %00101000
  523. %01000010
  524. %00100101
  525. %10011000
  526. %00011001
  527. %10100100
  528. %01000010
  529. %00010100
  530. %11100111
  531. %11100111
  532. %01000010
  533. %11111111
  534. %01111111
  535. %00111111
  536. %00011111
  537. %00000000
  538. %00000000
  539. %01111110
  540. %01000010
  541. %01111110
  542. %01000010
  543. %01111110
  544. %00100010
  545. %00011110
  546. %00010000
  547. %00010000
  548. %00000000
  549. %11010110
  550. %00000000
  551. %00010000
  552. %00010000
  553. %00000000
  554. %01010100
  555. %01111100
  556. %00111000
  557. %00111000
  558. %00111000
  559. %00111000
  560. %00111000
  561. %00010000
  562. %11111111
  563. %10100101
  564. %10110101
  565. %10100101
  566. %10101101
  567. %10100101
  568. %10110101
  569. %11111111
  570. %00000000
  571. %00111000
  572. %01000100
  573. %00000100
  574. %00111000
  575. %01000000
  576. %01000100
  577. %00111000
  578. %00000000
  579. %01000100
  580. %01000100
  581. %01000100
  582. %01111100
  583. %01000100
  584. %00101000
  585. %00010000
  586. %00000000
  587. %00000000
  588. %00000000
  589. %00000000
  590. %00000000
  591. %00000000
  592. %00000000
  593. %00000000
  594. end
  595.  
  596. player0height = 7 : player1height = 7
  597.  
  598. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement