Advertisement
Nick_Vars

Atari 2600 Game

Sep 29th, 2013
3,274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  rem This is made by Nick, basically it's an average Atari game
  2.  rem Create the title screen
  3. opening
  4.  playfield:
  5.  .X..X.XXX.XXX.X...X...XXX.XX....
  6.  .X.X...X...X..X...X...X...X.X...
  7.  .XX....X...X..X...X...XX..XX....
  8.  .X.X...X...X..X...X...X...X.X...
  9.  .X..X.XXX.XXX.XXX.XXX.XXX.X..X..
  10.  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  11.  ................................
  12.  ..........XXX...XXX.............
  13.  ..........X.X...X...............
  14.  ..........XXX....XX.............
  15.  ..........X...X.XXX.X...........
  16. end
  17.  
  18.  rem Loop the screen until the spacebar is pressed
  19. title
  20.  COLUBK = $60
  21.  COLUPF = 212
  22.  drawscreen
  23.  if joy0fire || joy1fire then goto skiptitle
  24.  goto title
  25.  
  26.  rem This function displays after the title is skipped
  27. skiptitle
  28.  
  29.  rem Colors
  30.  COLUPF = 0
  31.  COLUBK = 212
  32.  
  33.  rem Player location
  34.  player0x = 50 : player0y = 50
  35.  player1x = 20 : player1y = 20
  36.  rem Score setting and color
  37.  score = 100 : scorecolor = 1
  38.  
  39.  rem Missle size and location
  40.  missile0height=1:missile0y=255
  41.  NUSIZ0 = 2
  42.  
  43.  rem Create a variable to keep up with lives
  44.  a = 10
  45.  
  46.  rem Create the playfield
  47.  playfield:
  48.  X..............................X
  49.  X..............................X
  50.  X..............................X
  51.  X..............................X
  52.  X..............................X
  53.  X..............................X
  54.  X..............................X
  55.  X..............................X
  56.  X..............................X
  57.  X..............................X
  58.  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  59. end
  60.  
  61.  rem This main function is what loops constantly
  62. main
  63.  
  64.  rem This is the animation function
  65. animate
  66.  rem This frame variable slows down the animation
  67.  v = v + 1
  68.  
  69.  rem This code animates the sprites
  70.  if v = 7 && w = 0 then ax
  71.  if v = 7 && w = 1 then bx
  72.  if v = 7 && w = 2 then cx
  73.  if v = 7 && w = 3 then dx
  74.  
  75.  goto nextstep
  76.  
  77.  rem These four sprites are different stages of the animation
  78. ax
  79.  v = 0
  80.  w = 1
  81.  player1:
  82.  %00001000
  83.  %01101000
  84.  %00101000
  85.  %01010000
  86.  %01011110
  87.  %01110000
  88.  %00011000
  89.  %00011000
  90. end
  91.  goto nextstep
  92.  
  93. bx
  94.  v = 0
  95.  w = 2
  96.  player1:
  97.  %00100000
  98.  %01110000
  99.  %00101000
  100.  %01010000
  101.  %01011110
  102.  %01110000
  103.  %00011000
  104.  %00011000
  105. end
  106.  goto nextstep
  107.  
  108. cx
  109.  v = 0
  110.  w = 3
  111.  player1:
  112.  %00011000
  113.  %00011000
  114.  %00101000
  115.  %01010000
  116.  %01011110
  117.  %01110000
  118.  %00011000
  119.  %00011000
  120. end
  121.  goto nextstep
  122.  
  123. dx
  124.  v = 0
  125.  w = 0
  126.  player1:
  127.  %00100000
  128.  %01110000
  129.  %00101000
  130.  %01010000
  131.  %01011110
  132.  %01110000
  133.  %00011000
  134.  %00011000
  135. end
  136.  goto nextstep
  137.  
  138.  rem Create acorn sprite
  139. nextstep
  140.  player0:
  141.  %00111100
  142.  %01011010
  143.  %00100100
  144.  %00111100
  145.  %00011000
  146.  %00011000
  147.  %00010000
  148.  %00010000
  149. end
  150.  rem check to see if a missile has already been fired
  151. checkfire
  152.  if missile0y>240 then goto skip
  153.  missile0y = missile0y - 2 : goto draw
  154.  
  155.  rem if a missile hasn't been fired, then fire missile
  156. skip
  157.  if joy0fire then missile0y=player0y-2:missile0x=player0x+4
  158.  
  159.  rem Draw output to screen
  160. draw
  161.  drawscreen
  162.  
  163.  rem Fix player wraparound bug
  164.  if player0x < 8 then player0x = 8
  165.  if player0x > 150 then player0x = 150
  166.  if player0y < 8 then player0y = 8
  167.  if player0y > 84 then player0y = 84
  168.  
  169.  rem Have player 1 chase player 2
  170.  if player1y < player0y then player1y = player1y + 1
  171.  if player1y > player0y then player1y = player1y - 1
  172.  if player1x < player0x then player1x = player1x + 1
  173.  if player1x > player0x then player1x = player1x - 1
  174.  player1x = player1x : player1y = player1y
  175.  
  176.  
  177.  rem Detect missile collision with guard
  178.  if collision(missile0,player1) then score=score+1:player1x=rand/2:player1y=0:missile0y=255:goto pointsound
  179.  rem Detect guard collision with the you
  180.  if collision(player0,player1) then score=score-1:player1x=rand/2:player1y=0:missile0y=255:a=a-1:goto deadsound
  181.  
  182.  rem joystick movements
  183.  if joy0up then player0y = player0y-1 : goto skipmove
  184.  if joy0down then player0y = player0y+1 : goto skipmove
  185.  if joy0left then player0x = player0x-1 : goto skipmove
  186.  if joy0right then player0x = player0x +1 : goto skipmove
  187.  
  188.  rem refresh the screen
  189. skipmove
  190.  goto main
  191.  
  192.  rem Play point sound
  193. pointsound
  194.  AUDV0 = 3 : AUDC0 = 1 : AUDF0 = 49
  195.  p = p + 1
  196.  drawscreen
  197.  if p < 2 then pointsound
  198.  p = 0
  199.  AUDV0 = 0 : AUDC0 = 0 : AUDF0 = 0
  200.  goto main
  201.  
  202.  rem Play dead sound
  203. deadsound
  204.  AUDV1 = 10
  205.  AUDC1 = 7
  206.  AUDF1 = 12
  207.  p = p + 1
  208.  drawscreen
  209.  if p < 10 then deadsound
  210.  p = 0
  211.  AUDV1 = 0 : AUDC1 = 0 : AUDF1 = 0
  212.  if a = 0 then goto opening
  213.  goto main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement