Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rem SPACE TANKS for the Atari VCS
- rem Geek Basic Computers 2013 www.geekbasic.com
- rem programmed by: Gemino Michael Smothers
- set tv ntsc
- set romsize 4k
- set optimization noinlinedata
- dim mapx=a
- dim mapy=b
- dim area=c
- dim object=d
- dim shield=e
- dim ammo=f
- dim anim=g
- dim dir=h
- dim aimx=i
- dim aimy=j
- dim delay=k
- dim shoot=l
- dim key=m
- dim kills=n
- dim chance=o
- dim tempx1=p
- dim tempy1=q
- dim tempx2=r
- dim tempy2=s
- dim sfx=t
- dim slen=u
- dim explode=v
- dim flag=w
- dim npcshield=x
- dim autolock=y
- dim bigmissile=z
- dim P0plo = player0pointerlo
- dim P1plo = player1pointerlo
- dim P0x = player0x
- dim P0y = player0y
- dim P1x = player1x
- dim P1y = player1y
- dim M0x = missile0x
- dim M0y = missile0y
- dim M1x = missile1x
- dim M1y = missile1y
- const p0_0 = $81
- const p0_1 = p0_0 + 8
- const p0_2 = p0_0 + 16
- const p1_0 = $99
- const p1_1 = p1_0 + 8
- const p1_2 = p1_0 + 16
- const p1_3 = p1_0 + 24
- const p1_4 = p1_0 + 32
- const p1_5 = p1_0 + 40
- const p1_6 = p1_0 + 48
- const p1_7 = p1_0 + 56
- const p1_8 = p1_0 + 64
- const p1_9 = p1_0 + 72
- const p1_A = p1_0 + 80
- ammo = 60 : shield = 60 : P0x = 45 : P0y = 45 : M0y = 45 : M0x = 55
- gosub titlecols
- flag=99
- titleloop
- flag = flag + 1
- if flag = 100 then playfield:
- ......XXX..X...XX...XX...X.....
- .....X....X.X.X..X.X....X......
- ......XX..XX..XXXX.X....XX.....
- ........X.X...X..X.X....X......
- .....XXX..X...X..X..XX...X.....
- ...............................
- .....XXX..XX..X..X.X.X..XXX....
- ......X..X..X.XX.X.X.X.X.......
- ......X..XXXX.X.XX.XX...XX.....
- ......X..X..X.X..X.X.X....X....
- ......X..X..X.X..X.X.X.XXX.....
- end
- if flag = 200 then playfield:
- .........XXX..X..X.X.X.........
- ........X....X..X..X.X.........
- ........X.XX.XX.XX.XX..........
- ........X..X.X..X..X.X.........
- .........XX...X..X.X.X.........
- ...............................
- ......XX...XX...XXX.XXX..XX....
- .....X..X.X..X.X.....X..X......
- .....X.XX.XXXX..XX...X..X......
- .....X..X.X..X....X..X..X......
- .....XXX..X..X.XXX..XXX..XX....
- end
- if flag = 200 then flag = 0
- if !joy0fire && !joy1fire then drawscreen : goto titleloop
- gosub set_players
- area = 4
- playfield:
- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- X..............................X
- X..............................X
- X..............................X
- X..............................X
- X..............................X
- X..............................X
- X..............................X
- X..............................X
- X..............................X
- XXXXXXXXXXXXX.....XXXXXXXXXXXXXX
- end
- loadroom
- flag = mapy * 10 + mapx
- area = area ^ areas[flag]
- if area{0} then pfhline 13 0 17 flip
- if area{1} then pfvline 31 3 7 flip
- if area{2} then pfhline 13 10 17 flip
- if area{3} then pfvline 0 3 7 flip
- area = areas[flag] : flag = 0
- if mapx = 6 && mapy = 6 then object = 9 : goto gameloop else object = (rand & 15) + 1
- if object = 4 || object > 8 then object = 0
- if !mapx && !mapy then object = 0
- npcshield = object
- P1x = (rand & 110) + 20
- P1y = (rand & 60) + 20
- gameloop
- COLUPF = $00
- COLUBK = $E6
- COLUP0 = $04
- if anim = 11 then anim = 0
- if anim < 6 then P0plo = p0_0
- if anim > 5 then P0plo = p0_1
- if P0y < 10 && mapy then mapy = mapy - 1 : P0y = 85 : goto loadroom
- if P0x > 135 && mapx < 9 then mapx = mapx + 1 : P0x = 20 : goto loadroom
- if P0y > 85 && mapy < 10 then mapy = mapy + 1 : P0y = 20 : goto loadroom
- if P0x < 15 && mapx then mapx = mapx - 1 : P0x = 130 : goto loadroom
- if collision(player0,playfield) && dir then P0x = P0x + dx[dir] : P0y = P0y + dy[dir] : goto skipmove
- if !explode && flag then flag = 0
- if flag = 1 then skipmove
- temp1 = (SWCHA ^ $F0) / 16
- if temp1 && !collision(player0,playfield) then dir = dirt[temp1] : P0x = P0x - dx[dir] : P0y = P0y - dy[dir] : flag = 2 : anim = anim + 1
- skipmove
- if joy1up && M0y > 8 then M0y = M0y - 1
- if joy1right && M0x < 155 then M0x = M0x + 1
- if joy1down && M0y < 80 then M0y = M0y + 1
- if joy1left && M0x > 5 then M0x = M0x - 1
- if autolock then M0x = P1x + 3 : M0y = P1y - 2
- temp1 = object / 8 : temp2 = setb[object]
- if cP1f[temp1] & temp2 then COLUP1 = cP1[object]
- if NS1f[temp1] & temp2 then NUSIZ1 = NS1[object]
- if P1f[temp1] & temp2 then P1plo = P1[object]
- on object gosub o0 o1 o2 o3 o4 o5 o6 o7 o8 o9
- skipo
- if joy0fire then tempx1 = P0x : tempy1 = P0y : tempx2 = P1x : tempy2 = P1y : goto huddisplay
- dead
- if switchreset then reboot
- drawscreen
- AUDV0=0
- if flag = 2 then AUDV0 = 4 : AUDC0 = 2 : AUDF0 = 3 : flag = 0
- if slen then AUDV0 = 10 : AUDC0 = 4 : AUDF0 = sfx : sfx = sfx - 1
- if slen && !sfx then sfx = 6 : slen = slen - 1
- if sfx > 0 && !slen then AUDV0 = 10 : AUDC0 = 8 : AUDF0 = 5 : sfx = sfx - 1
- if shield > 250 then goto dead
- goto gameloop
- data areas
- 4, 6, 10, 10, 10, 12, 6, 10, 10, 12
- 5, 5, 6, 10, 10, 9, 5, 6, 12, 5
- 3, 15, 9, 2, 10, 10, 8, 5, 3, 9
- 6, 9, 6, 8, 6, 10, 12, 3, 10, 12
- 5, 6, 9, 2, 15, 12, 3, 10, 10, 9
- 5, 3, 12, 6, 15, 15, 8, 6, 10, 12
- 3, 12, 5, 5, 5, 3, 8, 3, 8, 5
- 2, 15, 15, 9, 3, 12, 6, 10, 10, 9
- 6, 15, 15, 12, 6, 9, 3, 10, 10, 12
- 6, 9, 1, 1, 6, 11, 11, 11, 11, 9
- end
- data setb
- %00000001, %00000010, %00000100, %00001000, %00010000, %00100000, %01000000, %10000000
- %00000001, %00000010
- end
- data cP1f
- %10011110, %000000011
- end
- data cP1
- $48, $44, $0E, $12, $B8, $00, $00, $C2, $0A, $04
- end
- data NS1f
- %10001110, %000000010
- end
- data NS1
- $00, $00, $07, $07, $00, $00, $00, $00, $00, $07
- end
- data P1f
- %10011111, %000000011
- end
- data P1
- p1_A, p1_1, p1_2, p1_3, p1_4, p1_0, p1_0, p1_5, p1_6, p1_7
- end
- data dirt
- 0, 1, 3, 1, 4, 1, 3, 1, 2, 1
- end
- const dx = dy + 1
- data dy
- 0, 1, 0, -1, 0, 1
- end
- o0
- if explode then explode = explode - 1 : COLUP1 = $48 : P1plo = p1_0
- if !explode = 0 && flag = 1 then object = 4 : flag = 0
- gosub hidemissile
- return
- o1
- o2
- if joy1fire then gosub checkfire
- if object = 2 then shoot = 0 : gosub hidemissile
- delay = delay + 1
- if object = 1 && delay < 3 then skipmove2
- if shoot then skipmove2
- delay = 0
- if aimy = 0 then P1y = P1y - 1
- if aimx = 1 then P1x = P1x + 1
- if aimy = 1 then P1y = P1y + 1
- if aimx = 0 then P1x = P1x - 1
- skipmove2
- if P1y < 20 then aimy = 1
- if P1x > 120 then aimx = 0
- if P1y > 80 then aimy = 0
- if P1x < 20 then aimx = 1
- if collision(player0,player1) then shield = shield - 1 : sfx = 4
- if object = 2 then return
- if P0y = P1y && P0x < P1x && shoot = 0 then M1x = P1x + 4 : M1y = P1y - 3 : shoot = 1
- if P0y = P1y && P0x > P1x && shoot = 0 then M1x = P1x + 4 : M1y = P1y - 3 : shoot = 2
- if shoot = 1 then M1x = M1x - 2
- if shoot = 2 then M1x = M1x + 2
- if M1x < 20 || M1x > 135 then gosub hidemissile : shoot = 0
- if collision(player0,missile1) then shield = shield - 5 : shoot = 0 : sfx = 7 : gosub hidemissile
- return
- o3
- if joy1fire then gosub checkfire
- delay = delay + 1
- if delay < 3 then goto skipmove3
- delay = 0
- if P0y < P1y then P1y = P1y - 1
- if P0x > P1x then P1x = P1x + 1
- if P0y > P1y then P1y = P1y + 1
- if P0x < P1x then P1x = P1x - 1
- skipmove3
- if collision(player0,player1) then shield = shield - 1 : sfx = 2
- return
- o4
- if collision(player0,player1) then object = 0 : key = key + 1 : slen = 3 : sfx = 6
- return
- o5
- gosub hidemissile
- gosub shieldsprite
- if collision(player0,player1) then object = 0 : shield = shield + 15 : slen = 3 : sfx = 6
- if shield > 200 then shield = 200
- return
- o6
- gosub hidemissile
- gosub ammosprite
- if collision(player0,player1) then object = 0 : ammo = ammo + 10 : slen = 3 : sfx = 6
- if ammo > 200 then ammo = 200
- return
- o7
- if collision(player0,player1) then object=0 : autolock = 3 : slen = 3 : sfx = 6
- return
- o8
- if collision(player0,player1) then object = 0 : bigmissile = 3 : slen = 3 : sfx = 6
- return
- o9
- P1x = 45
- P1y = 30
- if collision(player0,player1) && key = 3 then goto win
- return
- huddisplay
- gosub shieldsprite
- P0x=30 : M0x=40 : P0y=80 : M0y=80
- missile0height = shield
- gosub ammosprite
- P1x=50 : M1x=60 : P1y=80 : M1y=80
- missile1height = ammo
- drawscreen
- if joy0fire then goto huddisplay
- P0x = tempx1
- P0y = tempy1
- P1x = tempx2
- P1y = tempy2
- gosub hidemissile
- goto gameloop
- titlecols
- COLUPF = $46
- COLUBK = $00
- scorecolor = $00
- return
- shieldsprite
- COLUP1 = $86
- P1plo = p1_8
- if joy0fire then COLUP0 = $86 : P0plo = p0_2
- return
- ammosprite
- COLUP1 = $44 : P1plo = p1_9
- return
- hidemissile
- missile0height = 0 : missile1height = 0 : M1x = 0 : M1y = 0
- return
- checkfire
- if ammo > 0 then ammo = ammo - 1 : sfx = 25 else goto skipfire
- if !collision(missile0,player1) then goto skipfire
- if npcshield && !bigmissile then npcshield = npcshield - 1 : goto skipfire
- if npcshield && bigmissile then npcshield = 0
- if key < 3 then kills = kills + 1
- if kills > 10 then flag = 1 : kills = 0 : score = score + 500
- if object <> 4 then score = score + 100
- if autolock then autolock = autolock - 1
- if bigmissile then bigmissile = bigmissile - 1
- explode = 25
- object = 0
- skipfire
- return
- win
- gosub titlecols
- P0y = 0 : P1y = 0
- playfield:
- ..X.X..X..XXX..XXX.X..XX..X..X.
- .X.X.X.X.X....X....X.X..X.XX.X.
- .X.X.X.X..XXX..XX..X.X..X.X.XX.
- .X.X.X.X....X....X.X.X..X.X..X.
- .X.X.X.X.XXX..XXX..X..XX..X..X.
- ...............................
- .XX..XX...X.X...X..X...X.XXX..X
- X...X..X.X.X.X.X.X.X..X...X..X.
- X...X..X.X.X.X.XX..X..XX..X..XX
- X...X..X.X.X.X.X...X..X...X..X.
- .XX..XX..X.X.X.X...XX..X..X...X
- end
- if switchreset then reboot
- drawscreen
- goto win
- set_players
- player0:
- %10101011
- %01010101
- %11111111
- %11111111
- %01111110
- %00011000
- %01111000
- %00000000
- %11010101
- %10101010
- %11111111
- %11111111
- %01111110
- %00011000
- %01111000
- %00000000
- %00000000
- %00111000
- %01000100
- %00000100
- %00111000
- %01000000
- %01000100
- %00111000
- end
- player1:
- %00000100
- %01111110
- %11111100
- %01111110
- %00111110
- %11111110
- %00111100
- %01011110
- %01100110
- %00100100
- %00011000
- %00011000
- %01111110
- %11011000
- %00111100
- %00111100
- %00101000
- %01000010
- %00100101
- %10011000
- %00011001
- %10100100
- %01000010
- %00010100
- %11100111
- %11100111
- %01000010
- %11111111
- %01111111
- %00111111
- %00011111
- %00000000
- %00000000
- %01111110
- %01000010
- %01111110
- %01000010
- %01111110
- %00100010
- %00011110
- %00010000
- %00010000
- %00000000
- %11010110
- %00000000
- %00010000
- %00010000
- %00000000
- %01010100
- %01111100
- %00111000
- %00111000
- %00111000
- %00111000
- %00111000
- %00010000
- %11111111
- %10100101
- %10110101
- %10100101
- %10101101
- %10100101
- %10110101
- %11111111
- %00000000
- %00111000
- %01000100
- %00000100
- %00111000
- %01000000
- %01000100
- %00111000
- %00000000
- %01000100
- %01000100
- %01000100
- %01111100
- %01000100
- %00101000
- %00010000
- %00000000
- %00000000
- %00000000
- %00000000
- %00000000
- %00000000
- %00000000
- %00000000
- end
- player0height = 7 : player1height = 7
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement