home *** CD-ROM | disk | FTP | other *** search
/ Merciful 3 / Merciful_Release_3.bin / software / h / henrys_house / henryshouse1.dms / henryshouse1.adf / SourceCode / Level3.Asc < prev    next >
Text File  |  1993-06-20  |  38KB  |  1,124 lines

  1. '                                Henry's House 
  2. '
  3. '                           LEVEL THREE SOURCE CODE  
  4. '
  5. '                          by : Gurmita & Sucha Singh
  6. '
  7. '----------------------------------------------------------------------------- 
  8. ' NOTE:This source code can not be Run through the AMOS editor as some files 
  9. ' need to be copied into memory which is done in the startup-sequence of the 
  10. ' full Game(see Intro source code).
  11. '
  12. ' The following source code reseaves the Main variables LIVES,SC,EXSC and
  13. ' LEVEL.It then asks you to 'Press Fire' on the loading screen and then starts 
  14. ' the Level. 
  15. '
  16. ' Memory Banks Used: 
  17. '  1 - Sprites - Sprites 
  18. '  5 - Sound - Main samples
  19. '  6 - Sound - In Game samples 
  20. '  9 - Pac Pic - Control panel 
  21. ' 10 - Pac Pic - Background picture
  22. ' 11 - Pac Pic - Bonus screen background 
  23. '
  24. ' Bobs and Sprites Used: 
  25. ' Bob  1 - Tank
  26. ' Bob  2 - Train 
  27. ' Bob  3 - Jack-in-the-box 
  28. ' Bob  4 to 9 - Asteroids
  29. ' Bob 10 - Player Ship Explosion 
  30. ' Bob 10 - Henry Crying
  31. ' Bob 11 - Asteroid Explosion
  32. ' Bob 15 - Laser 
  33. ' Bob 26 - Henry Hit 
  34. ' Sprite  8 - Player 
  35. ' Sprite 10 - Bomb 
  36. ' Sprite 12 - Cork 
  37. ' Sprite 13 to 19 - Items
  38. ' Sprite 22 - Bonus Entrance 
  39. ' Sprite 24 - Exit 
  40. '
  41. ' Variables Used:
  42. ' X     - Player sprites X coordinates.
  43. ' Y     - Player sprites Y coordinates.
  44. ' I     - Player sprite Image. 
  45. ' D     - Start direction image for player.
  46. ' A     - The number of items you have collected.
  47. ' F     - The platform colour which you collide with.
  48. ' N     - The current height of Henry when jumping.
  49. ' SC    - Your current score.
  50. ' EXSC  - Increases with your score but gets set to 0 if it equals 2000 when 
  51. '         you get an extra life. 
  52. ' LEVEL - The level number which effects the images of the doors.
  53. ' LIVES - Number of lives Henry has. 
  54. ' BONUS - BONUS=1 when you're in the normal level or BONUS=0 when you enter
  55. '         the bonus stage. 
  56. ' BLINK - Time taken for player to start blinking if left alone. 
  57. ' TIME  - The level time limit.
  58. ' COUNT - Used to slow down the time.
  59. ' GONG  - Timer for the Gong sfx.
  60. ' SPEED - Gradgually increases the speed of the asteroids. 
  61. ' AX()  - Asteroids X coordinates. 
  62. ' AY()  - Asteroids Y coordinates. 
  63. ' ADY() - The speed of the asteroids.
  64. ' SX    - Player ship X coordinates. 
  65. ' SY    - Player ship Y coordinates. 
  66. ' SHIP  - Player ship's image number.
  67. ' MISSILE - Activates ship's laser.
  68. ' MX    - Laser X coordinates. 
  69. ' MY    - Laser Y coordinates. 
  70. ' Z     - Asteriod's array number. 
  71. ' DEAD  - Used to exit out of bonus stage if your ship explodes. 
  72. ' C     - Collision value for asteroids. 
  73. ' DELAY - Used as a timer to wait until the player ship has finished exploding.
  74. '
  75. '----------------------------------------------------------------------------- 
  76. '
  77. ' Increase sprite buffer.
  78. Set Sprite Buffer 256
  79. '
  80. ' Close the AMOS editor to save memory.
  81. Close Editor 
  82. '
  83. ' Make arrays for the asteroids. 
  84. Dim AX(9),AY(9),ADY(9)
  85. '
  86. ' Make the variables global so the whole program can access them.
  87. Global X,Y,I,D,A,F,N,SC,EXSC,LEVEL,LIVES,BONUS,BLINK,TIME,COUNT,GONG
  88. Global SPEED,AX(),AY(),ADY()
  89. Global SX,SY,SHIP,MISSILE,MX,MY,Z,DEAD,C,DELAY
  90. '
  91. ' Set the variables. 
  92. X=320 : Y=218 : I=1 : D=0 : A=0 : BONUS=1 : BLINK=0 : TIME=80 : COUNT=0 : GONG=80
  93. SX=294 : SY=190 : SHIP=67 : MISSILE=0 : MX=260 : MY=200 : DEAD=0 : DELAY=0
  94. SPEED=100^10
  95. '
  96. '----------------------------------------------------------------------------- 
  97. ' Calls the SETUP procedure. 
  98. _SETUP
  99. '
  100. ' Creates a mask for the sprites,sets Autoback to manual,turns off the 
  101. ' automatic updating and updates every 2 vertical blank periods to make the
  102. ' Amal animations smoother.
  103. Make Mask : Autoback 0 : Update Off : Update Every 2
  104. '
  105. '----------------------------------------------------------------------------- 
  106. ' Calls the BLINK procedure. 
  107. _BLINK
  108. '
  109. ' Calls the MAINLOOP procedure.
  110. _MAINLOOP
  111. '----------------------------------------------------------------------------- 
  112. '
  113. ' Uses Screen Swap which updates everything at once so making the Game run 
  114. ' faster.Updates the timer,checks for collisions,the joystic,the platforms and 
  115. ' the soundfx. 
  116. Procedure _MAINLOOP
  117.    '
  118.    ' Manualy updates all the bobs so there is no flicker at the start.
  119.    Bob Clear : Bob Draw 
  120.    '
  121.    ' The loop is divided into two parts. The first is used to perform the 
  122.    ' various instructions in your program and the secound part repeats the  
  123.    ' above contents.This keeps the loop in sync.
  124.    Do 
  125.       ' Swaps between the Phisical and Logical screens then clears the screen  
  126.       ' of bobs. 
  127.       Screen Swap 0
  128.       Wait Vbl 
  129.       Bob Clear 
  130.       '
  131.       ' Calls the TIME and EXTRA LIFE procedures and sets the Joystic. 
  132.       _TIME
  133.       _EXTRA_LIFE
  134.       J=Joy(1)
  135.       '
  136.       ' Checks the collision between the player sprite and other bobs and sprites. 
  137.       If Spritebob Col(8,1 To 3) Then _DEAD
  138.       If I Sprite(10)<>58 and Sprite Col(8,10 To 10) Then _DEAD
  139.       If I Sprite(12)<>58 and Sprite Col(8,12 To 12) Then _DEAD
  140.       If Sprite Col(8,13 To 19) Then _GET_ITEM
  141.       If Sprite Col(8,22 To 22) Then _BONUS
  142.       If Sprite Col(8,24 To 24) Then _EXIT
  143.       '
  144.       ' Places the next wave of itmes. 
  145.       If A=7 Then MORE_ITEMS
  146.       '
  147.       ' Places the Exit on screen when you have collected all the items. 
  148.       If A=15 : Sprite 24,170,232,65 : A=16 : End If 
  149.       '
  150.       ' If all the items are collected within the timelimit then the Bonus 
  151.       ' entrance appears.
  152.       If A=16 and TIME>0 : Sprite 22,148,167,64 : TIME=0 : End If 
  153.       '
  154.       ' Checks for the joystic and floor,so if Henry is left alone on a  
  155.       ' platform the variable 'BLINK' increases or else it equals 0. 
  156.       If J=0 and F=2 Then Inc BLINK Else BLINK=0
  157.       If BLINK>20 Then _BLINK
  158.       '
  159.       ' Checks Left & Right joystic directions.If the joystic has been moved 
  160.       ' and Henry is away from the edge then he will either move left or right.  
  161.       ' The variable D sets the starting frame depending on the joystic direction    
  162.       ' you have moved.It then adds the frames to make Henry look like he's walking.     
  163.       If J=4 and X>138 Then Dec X : _TIME : D=6 : Inc C : If C mod 4=0 Then Add I,1,1 To 6
  164.       If J=8 and X<438 Then Inc X : _TIME : D=0 : Inc C : If C mod 4=0 Then Add I,1,1 To 6
  165.       '
  166.       ' Checks for Up,Up left and Up right directions.If the joystic has been  
  167.       ' moved in either of the up directions and Henry is on the platform then   
  168.       ' the relevant JUMP procedure is called. 
  169.       If J=1 and F=2 Then JUMP_UP
  170.       If J=5 and F=2 Then D=6 : JUMP_LEFT
  171.       If J=9 and F=2 Then D=0 : JUMP_RIGHT
  172.       '
  173.       ' Plays the various soundfx for the enemy depending on their images. 
  174.       If I Bob(3)=48 Then Sam Bank 6 : Sam Play %11,1
  175.       If I Bob(1)=16 Then Sam Bank 6 : Sam Play %11,2
  176.       If I Sprite(10)=27 Then Sam Bank 6 : Sam Play %11,3
  177.       If X Sprite(12)=151 Then Sam Bank 6 : Sam Play %11,4
  178.       ' Plays the Gong sfx when the Gong timer equals 0. 
  179.       If GONG=0 Then Sam Bank 5 : Sam Play %1110,3 : GONG=80
  180.       '
  181.       ' Checks for a collision between a colour on screen and the player sprite. 
  182.       F=Point(X Screen(X Sprite(8)),Y Screen(Y Sprite(8)))
  183.       '
  184.       ' If the colour is not equal to 2(the platform colour) then Henry will fall.   
  185.       If F<>2 Then Inc Y
  186.       '
  187.       ' Updates the player sprite and draws all the bobs on screen.
  188.       Sprite 8,X,Y,I+D
  189.       Sprite Update 
  190.       Bob Draw 
  191.       '
  192.       '----------------------------------------------------------------------- 
  193.       ' Swaps between the Phisical and Logical screens then clears the screen  
  194.       ' of bobs. 
  195.       Screen Swap 0
  196.       Wait Vbl 
  197.       Bob Clear 
  198.       J=Joy(1)
  199.       '
  200.       ' Checks for the joystic.By repeating it again it makes Henry walk faster. 
  201.       If J=4 and X>138 Then Dec X : D=6 : Inc C : If C mod 4=0 Then Add I,1,1 To 6
  202.       If J=8 and X<438 Then Inc X : D=0 : Inc C : If C mod 4=0 Then Add I,1,1 To 6
  203.       '
  204.       ' Checks for the collision between Henry and the platforms.
  205.       F=Point(X Screen(X Sprite(8)),Y Screen(Y Sprite(8)))
  206.       If F<>2 Then Inc Y
  207.       '
  208.       ' Updates the player sprite and draws the bobs on screen.
  209.       Sprite 8,X,Y,I+D
  210.       Sprite Update 
  211.       Bob Draw 
  212.    Loop 
  213.    '
  214. End Proc
  215. '
  216. ' Opens up a screen,sets the fonts,reseaves the variables from the last
  217. ' program then loads the bobs and sfx and waits until you have pressed fire
  218. ' on the loading screen to start the game. 
  219. Procedure _SETUP
  220.    '
  221.    ' Hides mouse pointer,opens screen 0 and screen 2 then hides them both.
  222.    Hide On 
  223.    Screen Open 0,320,200,32,Lowres : Screen Hide 0
  224.    Curs Off : Flash Off : Cls 0
  225.    Screen Open 2,320,30,16,Lowres : Screen Hide 2
  226.    Curs Off : Flash Off : Cls 0
  227.    '
  228.    ' Loads fonts from Disk2 then checks all fonts to make sure they have loaded.
  229.    Get Disc Fonts 
  230.    Screen 2
  231.    For F=0 To 6
  232.       Set Font F : T$="Amos 12345:"+Str$(F)
  233.       Text 0,0,T$
  234.    Next F
  235.    Cls 0
  236.    '
  237.    ' Unpacks the Control Panel to screen 2 hides it,fades it to black then
  238.    ' sets its display.
  239.    Unpack 9 To 2 : Screen Hide 2 : Fade 1 : Wait 15
  240.    Screen Display 2,130,252,320,30
  241.    '
  242.    ' Reseaves the command line$ then separates its contents into the 4 strings. 
  243.    Set Font 6
  244.    B$=Left$(Command Line$,3)
  245.    C$=Mid$(Command Line$,4,6)
  246.    D$=Mid$(Command Line$,10,5)
  247.    E$=Right$(Command Line$,1)
  248.    '
  249.    ' Converts the 4 strings into variables. 
  250.    LIVES=Val(B$) : SC=Val(C$) : EXSC=Val(D$) : LEVEL=Val(E$)
  251.    '
  252.    ' Prints the Lives,Score and Time onto the control panel.
  253.    If LIVES<10 Then Ink 2,0 : Text 39,20,B$ : Text 144,20,C$
  254.    If LIVES>9 Then Ink 2,0 : Text 27,20,B$ : Text 144,20,C$
  255.    Ink 2,0 : Text 278,20,"80"
  256.    '
  257.    ' Loads the powerpacked bobs and sfx.
  258.    Screen 0
  259.    'Ppload "Henry's_HouseD2:Bobs/SpritesLev3" 
  260.    'Ppload "Henry's_HouseD2:Sound/Mainsfx",5
  261.    '
  262.    ' Display message 'Press Fire To Start'. 
  263.    Screen 1 : Paste Bob 115,180,97
  264.    '
  265.    ' Small loop which keeps you at the loading screen until you press Fire. 
  266.    Do 
  267.       J=Joy(1)
  268.       If Fire(1)=-1 Then Exit 
  269.       Paste Bob 115,180,97 : Bob Update 
  270.       Wait Vbl 
  271.    Loop 
  272.    ' Small loop which repeats until you have released the fire button then
  273.    ' fades the screen and closes it.
  274.    Repeat 
  275.    Until Fire(1)=0
  276.    Screen 1 : Fade 1 : Wait 15 : Screen Close 1
  277.    '
  278.    ' Unpacks the background to screen 0,hides it then gets the sprite palette 
  279.    ' and Double Buffers the screen for no flicker.
  280.    Screen 0 : Unpack 10 To 0 : Screen Hide 0
  281.    Double Buffer 
  282.    '
  283.    ' Sets the hot spot to bottom centre for the Player images,calls the 
  284.    ' AMAL and ITEMS procedures and pastes the Soilder with cannon on screen.
  285.    For N=1 To 12 : Hot Spot N,$12 : Next 
  286.    _AMAL
  287.    _ITEMS
  288.    Paste Bob -5,22,41
  289.    '
  290.    ' Fades background to black then fades the Control Panel and Background
  291.    ' picture into view. 
  292.    Fade 1 : Wait 15
  293.    Screen 2
  294.    Screen Show 2
  295.    Fade 1,$0,$BBB,$FFF,$EB0,$E90,$FD0,$B70,$840,$520,$CF,$6E,$F7E,$F0,$A01,$D01,$EC8
  296.    Wait 15
  297.    Screen 0
  298.    Screen Show 0
  299.    Fade 1,$0,$BBB,$903,$484,$5B6,$886,$A97,$CB9,$652,$863,$A85,$555,$DDD,$5BE,$363,$B60,$34,$0,$888,$FFF,$520,$840,$B70,$FB0,$486,$5A8,$5CA,$8E,$8,$A01,$D01,$EC8
  300.    Wait 15
  301.    '
  302.    ' Sets the volume for all channels to maximum. 
  303.    Volume %1111,63
  304.    '
  305. End Proc
  306. '
  307. ' Updates the Time.
  308. Procedure _TIME
  309.    '
  310.    ' As long as the time is greater than 0 then the variable,to slow down the 
  311.    ' timer,can keep on increasing.
  312.    If TIME>0 Then Inc COUNT
  313.    '
  314.    ' Adds 1 to the TIME variable and decreases the GONG variable whenever COUNT=50. 
  315.    If COUNT>50
  316.       TIME=TIME-1 : Dec GONG : COUNT=0
  317.       ' Convert TIME variable to a string so it can be printed using 'Text'. 
  318.       A$=Str$(TIME)
  319.       Screen 2 : L=Text Length(A$) : Text 304-L,20,A$
  320.    End If 
  321.    '
  322.    ' Returns program back to relevant screen. 
  323.    If BONUS=1 Then Screen 0
  324.    If BONUS=0 Then Screen 1
  325.    '
  326. End Proc
  327. '
  328. ' Updates the lives,sets the death animation then plays it until its finished. 
  329. Procedure _DEAD
  330.    '
  331.    ' Decrease the LIVES by 1,convert variable into a string to display your lives.  
  332.    Screen 2
  333.    LIVES=LIVES-1
  334.    B$=Str$(LIVES) : LD=Text Length(B$) : Text 64-LD,20,B$
  335.    '
  336.    Screen 0
  337.    ' Match the Bob starting position with the Player sprite position. 
  338.    DX=X Screen(X Sprite(8)) : DY=Y Screen(Y Sprite(8))
  339.    Bob 26,DX,DY,94
  340.    ' Set Amal animation.
  341.    Channel 14 To Bob 26
  342.    I$="A 0,(94,0); M 0,-20,20; M 0,-4,4; M 0,-3,3; M 0,-3,4; M 0,2,4; M 0,3,3; M 0,15,5; M 0,250,46"
  343.    Amal 14,I$ : Amal On 14
  344.    ' Turn off player sprite,play Ouch sfx and update bobs.
  345.    Sprite Off 8
  346.    Sam Bank 5 : Sam Play %1110,2
  347.    Bob Clear : Bob Draw 
  348.    '    
  349.    ' Small loop to allow Henry to finish death sequence without causing any   
  350.    ' problems to the main loop eg,colliding while still playing the death anim. 
  351.    Repeat 
  352.       Screen Swap 0
  353.       Wait Vbl 
  354.       Bob Clear 
  355.       _TIME
  356.       '      
  357.       If I Bob(3)=48 Then Sam Bank 6 : Sam Play %11,1
  358.       If I Bob(1)=16 Then Sam Bank 6 : Sam Play %11,2
  359.       If I Sprite(10)=27 Then Sam Bank 6 : Sam Play %11,3
  360.       If X Sprite(12)=151 Then Sam Bank 6 : Sam Play %11,4
  361.       If GONG=0 Then Sam Bank 5 : Sam Play %1110,3 : GONG=80
  362.       '
  363.       Sprite Update 
  364.       Bob Draw 
  365.       '
  366.       Screen Swap 0
  367.       Wait Vbl 
  368.       Bob Clear 
  369.       '
  370.       Sprite Update 
  371.       Bob Draw 
  372.    Until Y Bob(26)>249
  373.    '
  374.    ' Check to see if the player has lost all their lives if so then call the
  375.    ' GAMEOVER procedure.
  376.    If LIVES=0 Then _GAMEOVER
  377.    '
  378.    ' Turn off Death animation,reset player starting position,'N' variable and 
  379.    ' image then swap screen and clear bobs to help stay in sync with mainloop.  
  380.    Amal Off 14 : X=320 : Y=216 : N=34 : I=2 : Sprite Update : Wait Vbl 
  381.    Screen Swap 0 : Wait Vbl : Bob Clear 
  382.    '
  383. End Proc
  384. '
  385. ' Makes Henry Jump up. 
  386. Procedure JUMP_UP
  387.    '
  388.    ' Change sample bank then play the Jumping sfx.
  389.    Sam Bank 5 : Sam Play %1100,5
  390.    '
  391.    ' First 'for next' loop makes Henry move up,tests for collisions and plays   
  392.    ' the soundfx. 
  393.    For N=1 To 34
  394.       Dec Y
  395.       If BONUS=1 Then _TIME : Rem Call TIME proc when your not in the Bonus stage. 
  396.       _EXTRA_LIFE
  397.       If Spritebob Col(8,1 To 3) Then N=34 : _DEAD
  398.       If I Sprite(10)<>58 and Sprite Col(8,10 To 10) Then N=34 : _DEAD
  399.       If I Sprite(12)<>58 and Sprite Col(8,12 To 12) Then N=34 : _DEAD
  400.       If Sprite Col(8,13 To 19) Then _GET_ITEM
  401.       If Y Sprite(8)<60 Then N=34 : Rem So Henry dos'nt go off screen. 
  402.       '
  403.       If I Bob(3)=48 Then Sam Bank 6 : Sam Play %11,1
  404.       If I Bob(1)=16 Then Sam Bank 6 : Sam Play %11,2
  405.       If I Sprite(10)=27 Then Sam Bank 6 : Sam Play %11,3
  406.       If X Sprite(12)=151 Then Sam Bank 6 : Sam Play %11,4
  407.       If GONG=0 Then Sam Bank 5 : Sam Play %1110,3 : GONG=80
  408.       Sprite 8,X,Y,I+D
  409.       Update 
  410.       Wait Vbl 
  411.    Next 
  412.    '
  413.    ' Secound loop makes Henry come down and checks for collisions with any    
  414.    ' platforms and other Sprites & Bobs and plays the soundfx.
  415.    For N=1 To 34
  416.       If BONUS=1 Then _TIME
  417.       _EXTRA_LIFE
  418.       F=Point(X Screen(X Sprite(8)),Y Screen(Y Sprite(8)))
  419.       If F<>2 Then Inc Y
  420.       ' If Henry touches a platform before N=34 then N=34 and exits out of loop.   
  421.       If F=2 Then N=34
  422.       '
  423.       If Spritebob Col(8,1 To 3) Then N=34 : _DEAD
  424.       If I Sprite(10)<>58 and Sprite Col(8,10 To 10) Then N=34 : _DEAD
  425.       If I Sprite(12)<>58 and Sprite Col(8,12 To 12) Then N=34 : _DEAD
  426.       If Sprite Col(8,13 To 19) Then _GET_ITEM
  427.       '
  428.       If I Bob(3)=48 Then Sam Bank 6 : Sam Play %11,1
  429.       If I Bob(1)=16 Then Sam Bank 6 : Sam Play %11,2
  430.       If I Sprite(10)=27 Then Sam Bank 6 : Sam Play %11,3
  431.       If X Sprite(12)=151 Then Sam Bank 6 : Sam Play %11,4
  432.       If GONG=0 Then Sam Bank 5 : Sam Play %1110,3 : GONG=80
  433.       Sprite 8,X,Y,I+D
  434.       Update 
  435.       Wait Vbl 
  436.    Next 
  437.    '
  438.    ' Reset 'N' variable and clear the bobs to keep in sync with mainloop. 
  439.    N=1
  440.    Bob Clear 
  441.    '
  442. End Proc
  443. '
  444. ' Makes Henry Jump up and left.
  445. Procedure JUMP_LEFT
  446.    '
  447.    ' Change sample bank,play the Jumping sfx and call the EXTRA LIFE procedure. 
  448.    Sam Bank 5 : Sam Play %1100,5
  449.    _EXTRA_LIFE
  450.    '
  451.    ' First 'for next' loop makes Henry move up and left,tests for collisions  
  452.    ' and plays the soundfx. 
  453.    For N=1 To 34
  454.       If BONUS=1 Then _TIME : Rem Call TIME proc when your not in the Bonus Stage. 
  455.       Add I,1,1 To 6 : Dec Y : If X>140 Then Dec X
  456.       '
  457.       If Spritebob Col(8,1 To 3) Then N=34 : _DEAD
  458.       If I Sprite(10)<>58 and Sprite Col(8,10 To 10) Then N=34 : _DEAD
  459.       If I Sprite(12)<>58 and Sprite Col(8,12 To 12) Then N=34 : _DEAD
  460.       If Sprite Col(8,22 To 22) Then _BONUS
  461.       If Y Sprite(8)<60 Then N=34 : Rem So Henry dos'nt go off screen. 
  462.       '
  463.       If I Bob(3)=48 Then Sam Bank 6 : Sam Play %11,1
  464.       If I Bob(1)=16 Then Sam Bank 6 : Sam Play %11,2
  465.       If I Sprite(10)=27 Then Sam Bank 6 : Sam Play %11,3
  466.       If X Sprite(12)=151 Then Sam Bank 6 : Sam Play %11,4
  467.       If GONG=0 Then Sam Bank 5 : Sam Play %1110,3 : GONG=80
  468.       Sprite 8,X,Y,I+D
  469.       Update 
  470.       Wait Vbl 
  471.    Next N
  472.    '
  473.    ' Secound loop makes Henry come down and move left checks for collisions   
  474.    ' with any platforms and other Sprites & Bobs and plays the soundfx. 
  475.    For N=1 To 34
  476.       If BONUS=1 Then _TIME
  477.       F=Point(X Screen(X Sprite(8)),Y Screen(Y Sprite(8)))
  478.       Add I,1,1 To 6 : If X>140 Then Dec X
  479.       If F<>2 Then Inc Y
  480.       ' If Henry touches a platform before N=34 then N=34 and exits out of loop.   
  481.       If F=2 Then N=34
  482.       '
  483.       If Spritebob Col(8,1 To 3) Then N=34 : _DEAD
  484.       If I Sprite(10)<>58 and Sprite Col(8,10 To 10) Then N=34 : _DEAD
  485.       If I Sprite(12)<>58 and Sprite Col(8,12 To 12) Then N=34 : _DEAD
  486.       If Sprite Col(8,22 To 22) Then _BONUS
  487.       '
  488.       If I Bob(3)=48 Then Sam Bank 6 : Sam Play %11,1
  489.       If I Bob(1)=16 Then Sam Bank 6 : Sam Play %11,2
  490.       If I Sprite(10)=27 Then Sam Bank 6 : Sam Play %11,3
  491.       If X Sprite(12)=151 Then Sam Bank 6 : Sam Play %11,4
  492.       If GONG=0 Then Sam Bank 5 : Sam Play %1110,3 : GONG=80
  493.       Sprite 8,X,Y,I+D
  494.       Update 
  495.       Wait Vbl 
  496.    Next N
  497.    '
  498.    ' Reset 'N' variable and clear the bobs to keep in sync with mainloop. 
  499.    N=1
  500.    Bob Clear 
  501.    '
  502. End Proc
  503. '
  504. ' Makes Henry Jump up and right. 
  505. Procedure JUMP_RIGHT
  506.    '
  507.    ' Change sample bank,play the Jumping sfx and calls the EXTRA LIFE procedure.. 
  508.    Sam Bank 5 : Sam Play %1100,5
  509.    _EXTRA_LIFE
  510.    '
  511.    ' First 'for next' loop makes Henry move up and right,tests for collisions   
  512.    ' and plays the soundfx. 
  513.    For N=1 To 34
  514.       If BONUS=1 Then _TIME : Rem Call TIME proc when your not in the Bonus Stage.   
  515.       Add I,1,1 To 6 : Dec Y : If X<436 Then Inc X
  516.       '
  517.       If Spritebob Col(8,1 To 3) Then N=34 : _DEAD
  518.       If I Sprite(10)<>58 and Sprite Col(8,10 To 10) Then N=34 : _DEAD
  519.       If I Sprite(12)<>58 and Sprite Col(8,12 To 12) Then N=34 : _DEAD
  520.       If Y Sprite(8)<60 Then N=34 : Rem So Henry dos'nt go off screen. 
  521.       '
  522.       If I Bob(3)=48 Then Sam Bank 6 : Sam Play %11,1
  523.       If I Bob(1)=16 Then Sam Bank 6 : Sam Play %11,2
  524.       If I Sprite(10)=27 Then Sam Bank 6 : Sam Play %11,3
  525.       If X Sprite(12)=151 Then Sam Bank 6 : Sam Play %11,4
  526.       If GONG=0 Then Sam Bank 5 : Sam Play %1110,3 : GONG=80
  527.       Sprite 8,X,Y,I+D
  528.       Update 
  529.       Wait Vbl 
  530.    Next 
  531.    '
  532.    ' Secound loop makes Henry come down and move right checks for collisions  
  533.    ' with any platforms and other Sprites & Bobs and plays the soundfx. 
  534.    For N=1 To 34
  535.       If BONUS=1 Then _TIME
  536.       F=Point(X Screen(X Sprite(8)),Y Screen(Y Sprite(8)))
  537.       Add I,1,1 To 6 : If X<436 Then Inc X
  538.       If F<>2 Then Inc Y
  539.       ' If Henry touches a platform before N=34 then N=34 and exits out of loop.   
  540.       If F=2 Then N=34
  541.       '
  542.       If Spritebob Col(8,1 To 3) Then N=34 : _DEAD
  543.       If I Sprite(10)<>58 and Sprite Col(8,10 To 10) Then N=34 : _DEAD
  544.       If I Sprite(12)<>58 and Sprite Col(8,12 To 12) Then N=34 : _DEAD
  545.       '
  546.       If I Bob(3)=48 Then Sam Bank 6 : Sam Play %1,1
  547.       If I Bob(1)=16 Then Sam Bank 6 : Sam Play %11,2
  548.       If I Sprite(10)=27 Then Sam Bank 6 : Sam Play %11,3
  549.       If X Sprite(12)=151 Then Sam Bank 6 : Sam Play %11,4
  550.       If GONG=0 Then Sam Bank 5 : Sam Play %1110,3 : GONG=80
  551.       Sprite 8,X,Y,I+D
  552.       Update 
  553.       Wait Vbl 
  554.    Next 
  555.    '
  556.    ' Reset 'N' variable and clear the bobs to keep in sync with mainloop. 
  557.    N=1
  558.    Bob Clear 
  559.    '
  560. End Proc
  561. '
  562. ' Makes Henry start blinking.
  563. Procedure _BLINK
  564.    '
  565.    ' Set the Amal animation of Henry blinking and turn the automatic updating on.   
  566.    Channel 15 To Sprite 8
  567.    Sprite 8,X,Y,
  568.    J$="A 0,(95,30)(96,10)(95,10)(96,10);"
  569.    Amal 15,J$ : Amal On 15 : Update On 
  570.    '
  571.    ' Small loop which repeats itself until you move Henry.
  572.    Do 
  573.       ' Call TIME procedure,set joystic,check for collisions between the 
  574.       ' player and enemy and play the soundfx. 
  575.       _TIME
  576.       J=Joy(1)
  577.       If Spritebob Col(8,1 To 3) Then Update Off : _DEAD : Exit 
  578.       If I Sprite(10)<>58 and Sprite Col(8,10 To 10) Then Update Off : _DEAD : Exit 
  579.       If I Sprite(12)<>58 and Sprite Col(8,12 To 12) Then Update Off : _DEAD : Exit 
  580.       '
  581.       If I Bob(3)=48 Then Sam Bank 6 : Sam Play %11,1
  582.       If I Bob(1)=16 Then Sam Bank 6 : Sam Play %11,2
  583.       If I Sprite(10)=27 Then Sam Bank 6 : Sam Play %11,3
  584.       If X Sprite(12)=151 Then Sam Bank 6 : Sam Play %11,4
  585.       If GONG=0 Then Sam Bank 5 : Sam Play %1110,3 : GONG=80
  586.       '
  587.       ' Check for any joystic movement then exits out of loop. 
  588.       If J>0 Then Exit 
  589.       ' Wait for a vertical blank. 
  590.       Wait Vbl 
  591.    Loop 
  592.    '
  593.    ' Turns off blinking animation,automatic updateing and reset the BLINK timer.    
  594.    Amal Off 15 : Update Off : BLINK=0
  595.    '
  596.    ' Update Bobs,swap screen then clear the bobs on screen to help stay in  
  597.    ' sync with the Main loop. 
  598.    Bob Clear : Bob Draw : Screen Swap 0 : Wait Vbl : Bob Clear 
  599.    '
  600. End Proc
  601. '
  602. ' Reverses the player images to make Henry's left facing images. 
  603. Procedure _REVERSESPRITES
  604.    '
  605.    ' Goes through the image of player,gets the image,sets the hot spot then 
  606.    ' pastes the fliped image. 
  607.    For N=1 To 6
  608.       Bob 1,16,27,N : Wait Vbl : Get Bob N+6,9,1 To 25,28
  609.       Hot Spot N+6,$12 : Paste Bob 500,500,Hrev(N+6)
  610.    Next : Bob Off 1 : Wait Vbl 
  611.    '
  612. End Proc
  613. '
  614. ' Sets the Amal animations for the enemy.
  615. Procedure _AMAL
  616.    '
  617.    ' Set the Channels for each enemy and their starting positions.
  618.    Channel 1 To Bob 1
  619.    Channel 2 To Sprite 10
  620.    Channel 3 To Bob 2
  621.    Channel 4 To Sprite 12
  622.    Channel 5 To Bob 3
  623.    Bob 1,304,116,13
  624.    Sprite 10,354,160,58
  625.    Bob 2,340,184,33
  626.    Sprite 12,150,96,45
  627.    Bob 3,160,82,46
  628.    '
  629.    ' Set Amal animation strings for each enemy. 
  630.    A$="Tank:A 0,(13,5)(14,5)(15,5); M -60,0,170; A 1,(13,5); M 0,0,10; A 1,(16,2)(17,5)(18,5)(13,5); M 0,0,17; A 1,(19,5)(20,5)(21,5)(22,5); M 0,0,20;"
  631.    A$=A$+"A 0,(23,5)(24,5)(25,5); M 60,0,170; A 1,(23,5); M 0,0,10; A 1,(22,5)(21,5)(20,5)(19,5)(13,5); M 0,0,25; Jump Tank"
  632.    '
  633.    B$="Bomb:A 0,(58,5); M 0,0,180; A 0,(26,5); M -25,-10,15; M -25,-5,15; M -25,5,15; M -25,10,15; M -25,15,15; A 1,(27,2)(28,5)(29,5)(30,5)(31,5)(32,5); M 0,0,27; A 0,(58,5); M 125,-15,5; M 0,0,135; Jump Bomb"
  634.    '
  635.    C$="Train:M 0,0,40; A 0,(33,5)(34,5)(35,5)(36,5); M-360,0,230; M 0,0,40; A 0,(37,5)(38,5)(39,5)(40,5); M 360,0,230; Jump Train"
  636.    '
  637.    D$="Cork:A 0,(45,5); M 0,0,55; M 1,0,1; A 0,(46,5); M 301,0,80; A 0,(58,5); M -302,0,5; Jump Cork"
  638.    '
  639.    E$="A 0,(47,5); M 0,0,40;"
  640.    E$=E$+"A 0,(47,5)(48,2)(49,4)(50,4)(51,4)(52,4)(49,4)(53,4)(54,4)(55,4)(56,4)(57,4)(47,60);"
  641.    '
  642.    ' Set the Channels to the strings then turn on the Amal animations.  
  643.    Amal 1,A$ : Amal 2,B$ : Amal 3,C$ : Amal 4,D$ : Amal 5,E$
  644.    Amal On 
  645.    '
  646. End Proc
  647. '
  648. ' Sets the positions for the first wave of items.
  649. Procedure _ITEMS
  650.    '
  651.    Sprite 13,170,170,59
  652.    Sprite 14,436,136,60
  653.    Sprite 15,220,74,62
  654.    Sprite 16,388,95,63
  655.    Sprite 17,410,238,61
  656.    Sprite 18,276,190,60
  657.    Sprite 19,180,238,61
  658.    '
  659. End Proc
  660. '
  661. ' Sets the positions for the secound wave of items.
  662. Procedure MORE_ITEMS
  663.    '
  664.    A=8 : Rem Sets number of items so the Mainloop only calls this procedure once.   
  665.    Sprite 13,202,116,60
  666.    Sprite 14,350,116,61
  667.    Sprite 15,400,150,63
  668.    Sprite 16,420,200,62
  669.    Sprite 17,224,168,59
  670.    Sprite 18,430,70,59
  671.    Sprite 19,220,220,63
  672.    '
  673. End Proc
  674. '
  675. ' Updates your score and turns off a sprite when you collect an item.
  676. Procedure _GET_ITEM
  677.    '
  678.    ' Turns off the sprite you have collided with,plays the Collect sfx and  
  679.    ' updates the EXSC variable. 
  680.    Sprite Off Col(-1) : Sam Bank 5 : Sam Play %1100,4 : A=A+1 : EXSC=EXSC+50
  681.    '
  682.    Screen 2
  683.    ' Updates your score variable. 
  684.    SC=SC+50
  685.    ' Turn score variable to string so it can be printed using 'Text'. 
  686.    C$=Str$(SC) : Text 144,20,C$
  687.    ' Return to screen 0.
  688.    Screen 0
  689.    '
  690. End Proc
  691. '
  692. ' Restarts the game after finishing the Bonus stage. 
  693. Procedure _RESTART
  694.    '
  695.    ' Fades the bonus screen,turns off all sprites,bobs,Amal animations and hides screen.
  696.    Screen 1 : Fade 1 : Wait 15 : Sprite Off : Bob Off : Amal Off : Screen Hide 1
  697.    '
  698.    ' Resets the A,BONUS,TIME,X and Y variables and turns on the enemy animations. 
  699.    Screen 0 : A=0 : BONUS=1 : TIME=0 : X=320 : Y=216 : Sprite Update : _AMAL
  700.    ' Resets the timer on the panel. 
  701.    Screen 2 : Ink 2,0 : Text 278,20,"00"
  702.    Screen 0 : Screen Show 0
  703.    '
  704.    ' Place Exit back on screen and fade screen into view. 
  705.    Sprite 24,170,232,65
  706.    Fade 1,$0,$BBB,$903,$484,$5B6,$886,$A97,$CB9,$652,$863,$A85,$555,$DDD,$5BE,$363,$B60,$34,$0,$888,$FFF,$520,$840,$B70,$FB0,$486,$5A8,$5CA,$8E,$8,$A01,$D01,$EC8
  707.    Wait 15
  708.    '
  709. End Proc
  710. '
  711. ' Exits out of game once you have finished the level.
  712. Procedure _EXIT
  713.    '
  714.    ' Play Door sfx,make door open then turn off player sprite.
  715.    Sam Bank 5 : Sam Play %1110,1
  716.    Sprite 24,170,232,66
  717.    Sprite Off 8
  718.    Sprite Update 
  719.    Wait 30
  720.    ' Fade screen,close it then reset player position. 
  721.    Screen 0 : Fade 2 : Wait 30 : Screen Close 0
  722.    X=320 : Y=215
  723.    '
  724.    '
  725.    ' Create 4 Main strings to hold the 4 main variables(LIVES,SC,EXSC,LEVEL). 
  726.    A$="   " : B$="      " : C$="     " : D$="  "
  727.    '
  728.    ' Convert the 4 variables into strings.
  729.    L$=Str$(LIVES) : S$=Str$(SC) : E$=Str$(EXSC) : LEV$=Str$(LEVEL)
  730.    '
  731.    ' Then place those strings into the above Main strings.
  732.    Right$(A$,3)=L$ : Left$(B$,6)=S$ : Right$(C$,5)=E$ : Right$(D$,2)=LEV$
  733.    '
  734.    ' Lastly place the final 4 strings into the Command Line$ to be passed   
  735.    ' through to the next program. 
  736.    Command Line$=A$+B$+C$+D$
  737.    '
  738.    ' Fade control panel,close it,turn off all Amal animations,erase memory  
  739.    ' banks then load the Select Level program.
  740.    Screen 2 : Fade 2 : Wait 30 : Screen Close 2
  741.    Amal Off 
  742.    For B=0 To 15 : Erase B : Next B
  743.    Run "HenryGame/Selectlevel"
  744.    '
  745. End Proc
  746. '
  747. ' Updates your lives every 2000 points.
  748. Procedure _EXTRA_LIFE
  749.    '
  750.    If EXSC=2000
  751.       Screen 2
  752.       ' Play Extra life sfx. 
  753.       Sam Bank 5 : Sam Play %1110,6
  754.       '
  755.       ' Update LIVES variable by 1 and convert it to a string. 
  756.       LIVES=LIVES+1 : B$=Str$(LIVES)
  757.       ' Print the score string and depending on whether its a single or  
  758.       ' double number offset the text position.  
  759.       If LIVES>9 : Text 27,20,B$ : End If 
  760.       If LIVES<10 : Text 40,20,B$ : End If 
  761.       '
  762.       ' Reset EXSC variable to 0 and then return to the relevant screen. 
  763.       EXSC=0
  764.       If BONUS=1 : Screen 0 : End If 
  765.       If BONUS=0 : Screen 1 : End If 
  766.    End If 
  767.    '
  768. End Proc
  769. '
  770. ' Plays the Game Over animation then loads the Title program.
  771. Procedure _GAMEOVER
  772.    '
  773.    ' Close the game and control panel screens.  
  774.    If BONUS=1
  775.       Screen 0 : Fade 2 : Wait 30 : Cls 0 : Sprite Off : Sprite Update : Wait Vbl : Bob Off : Amal Off : Screen Close 0
  776.       Screen 2 : Fade 2 : Wait 30 : Cls 0 : Screen Close 2
  777.    End If 
  778.    '
  779.    ' Open up new screen for animation,get the sprite palette,Double Buffer
  780.    ' screen for no flicker and turn update on.  
  781.    Screen Open 0,320,200,32,Lowres : Screen Hide 0
  782.    Curs Off : Flash Off : Cls 0
  783.    Get Sprite Palette 
  784.    Double Buffer : Update On 
  785.    '
  786.    ' Set Amal animation.  
  787.    Channel 15 To Bob 10
  788.    Bob 10,160,110,100
  789.    F$="A 0,(100,5)(101,5)(102,5)(103,5)(104,5)(105,5)"
  790.    Amal 15,F$ : Amal On 
  791.    '
  792.    ' Paste the 'Game Over' words on screen,fade screen to black then fade the 
  793.    ' screen into view.  
  794.    Paste Bob 70,10,98 : Paste Bob 164,10,99
  795.    Fade 1 : Wait 15
  796.    Screen Show 0
  797.    Fade 1,$0,$BBB,$903,$484,$5B6,$886,$A97,$CB9,$652,$863,$A85,$555,$DDD,$5BE,$363,$B60,$34,$0,$888,$FFF,$520,$840,$B70,$FB0,$486,$5A8,$5CA,$8E,$8,$A01,$D01,$EC8
  798.    Wait 15
  799.    '
  800.    ' Small loop which exits when the GO variable equals 120 or you press Fire.
  801.    Do 
  802.       Bob 10,160,110,
  803.       If Fire(1)=-1 Then Exit 
  804.       Inc GO
  805.       If GO>120 Then Exit 
  806.       Wait Vbl 
  807.    Loop 
  808.    ' Small loop which exits once you have released the Fire button. 
  809.    Repeat 
  810.       Bob 10,160,110,
  811.       Wait Vbl 
  812.    Until Fire(1)=0
  813.    Fade 2 : Wait 30
  814.    '
  815.    ' Prepare a string to hold the score string. 
  816.    A$="      "
  817.    ' Convert the score to a string. 
  818.    S$=Str$(SC)
  819.    ' Place score string into 'A$' then place it in the command line$. 
  820.    Left$(A$,6)=S$
  821.    Command Line$=A$
  822.    '
  823.    ' Turn off Amal animations,close screen,erase memory banks then run the
  824.    ' Title program. 
  825.    Amal Off 
  826.    Screen Close 0
  827.    For B=0 To 15 : Erase B : Next B
  828.    Run "HenryGame/Title"
  829.    '
  830. End Proc
  831. '
  832. '----------------------------------------------------------------------------- 
  833. '              *******  Procedures for the Bonus Stage. *******
  834. '
  835. ' Bonus stage mainloop which repeats until the timer runs out or your ship 
  836. ' hits an asteroid.
  837. Procedure _BONUS
  838.    '
  839.    ' Set the collect variable 'A',BONUS variable,TS(Timer used for the wait 
  840.    ' before the asteroids come on screen) and the new Time limit.   
  841.    A=16
  842.    BONUS=0 : TS=1 : TIME=99
  843.    ' Fade screen,turn off all sprites,bobs and animations then hide screen. 
  844.    Screen 0 : Fade 1 : Wait 15 : Sprite Off : Sprite Update : Bob Off : Amal Off : Screen Hide 0
  845.    '
  846.    ' Call the BSETUP procedure. 
  847.    _BSETUP
  848.    '
  849.    ' Loop handled in the same way as Mainloop(using screen swap).By using   
  850.    ' another mainloop for the Bonus stage the Game runs faster and smoother.
  851.    ' Exits out of Loop when the timer has reached 0 or the player ship hits 
  852.    ' an asteroid.   
  853.    Repeat 
  854.       '
  855.       ' Swaps between the Phisical and Logical screens then clears the screen  
  856.       ' of bobs. 
  857.       Screen Swap 1
  858.       Wait Vbl 
  859.       Bob Clear 
  860.       '
  861.       ' Sets the joystic,Calls the TIME and EXTRA LIFE procedures. 
  862.       _TIME
  863.       _EXTRA_LIFE
  864.       J=Joy(1)
  865.       ' Small timer set for the wait before the asteroids come on screen for 
  866.       ' the first time.  
  867.       TI=TI+TS
  868.       If TI=40 Then ALIENS : TS=0
  869.       '
  870.       ' Checks for the joystic and moves your Ship in the relevant direction.
  871.       If J=0 Then SHIP=67
  872.       If Jleft(1) and SX>194 Then SX=SX-4 : SHIP=68
  873.       If Jleft(1) and SX=194 Then SHIP=68
  874.       If Jright(1) and SX<400 Then SX=SX+4 : SHIP=69 : If SX>400 Then SX=SX-4
  875.       If Jup(1) and SY>60 Then SY=SY-4
  876.       If Jdown(1) and SY<248 Then SY=SY+4 : If SY>240 Then SY=SY-4
  877.       '
  878.       'Calls the relevant procedures.
  879.       _MOVEMISSILE
  880.       _MISSCOLLISION
  881.       _SHIPCOLLISION
  882.       '
  883.       ' Updates the player sprite and draws all the bobs on screen.
  884.       Sprite 8,SX,SY,SHIP
  885.       Bob Draw 
  886.       Sprite Update 
  887.       '
  888.       '----------------------------------------------------------------------- 
  889.       ' Swaps between the Phisical and Logical screens then clears the screen  
  890.       ' of bobs. 
  891.       Screen Swap 1
  892.       Wait Vbl 
  893.       Bob Clear 
  894.       ' Wait before the asteroids come on screen.  
  895.       TI=TI+TS
  896.       If TI=40 Then ALIENS : TS=0
  897.       '
  898.       ' Checks for the joystic and moves your Ship in the relevant direction.
  899.       If J=0 Then SHIP=67
  900.       If Jleft(1) and SX>194 Then SX=SX-4 : SHIP=68
  901.       If Jleft(1) and SX=194 Then SHIP=68
  902.       If Jright(1) and SX<400 Then SX=SX+4 : SHIP=69 : If SX>400 Then SX=SX-4
  903.       If Jup(1) and SY>60 Then SY=SY-4
  904.       If Jdown(1) and SY<248 Then SY=SY+4 : If SY>240 Then SY=SY-4
  905.       '
  906.       ' Calls the MOVEMISSILE procedure. 
  907.       _MOVEMISSILE
  908.       '
  909.       ' Updates the player sprite and draws all the bobs on screen.
  910.       Sprite 8,SX,SY,SHIP
  911.       Sprite Update 
  912.       Bob Draw 
  913.    Until DEAD=1 or TIME=0
  914.    '
  915.    ' Calls the RESTART procedure. 
  916.    _RESTART
  917.    '
  918. End Proc
  919. '
  920. ' Shows the Bonus level title screen then sets up the Bonus background and 
  921. ' enemy animations.
  922. Procedure _BSETUP
  923.    '
  924.    'Opens a screen then prints the information on the Title screen. 
  925.    Screen Open 1,320,200,32,Lowres : Screen Hide 1
  926.    Get Sprite Palette 
  927.    Curs Off : Flash Off : Colour 0,$0 : Cls 0 : Paper 0
  928.    Pen 23 : Locate 0,4 : Centre "STARBURST"
  929.    Pen 26 : Locate 0,7 : Centre "Bonus Game"
  930.    Pen 27 : Locate 0,10 : Centre "Get as many points as you can"
  931.    Locate 0,11 : Centre "by destroying the asteroids."
  932.    Locate 0,13 : Centre "Do this within the time limit and"
  933.    Locate 0,14 : Centre "one life."
  934.    Pen 30 : Locate 0,20 : Centre "Press Fire to start"
  935.    ' Prints the new Time limit. 
  936.    Screen 2 : Ink 2,0 : Text 278,20,"99"
  937.    '
  938.    ' Sets the Anal animation for the Ship on the title screen.
  939.    Screen 1
  940.    Channel 14 To Sprite 8
  941.    Sprite 8,294,190,
  942.    I$="A 0,(67,8)(68,8)(67,8)(69,8);"
  943.    Amal 14,I$ : Amal On 14
  944.    Screen Show 1
  945.    '
  946.    ' Small loop which exits when you press Fire.
  947.    Do 
  948.       F=Fire(1)
  949.       If F=-1 Then Exit 
  950.       Sprite 8,294,190, : Sprite Update : Wait Vbl 
  951.    Loop 
  952.    ' Small loop which exits once you have released the Fire button. 
  953.    Repeat 
  954.       Sprite 8,294,190, : Sprite Update : Wait Vbl 
  955.    Until Fire(1)=0
  956.    ' Fade title screen then turn off Amal animation and Ship. 
  957.    Fade 1 : Amal Off 14 : Sprite Off 8 : Wait 15
  958.    '
  959.    ' Unpack the Bonus Background to screen 1 then hide it.
  960.    Unpack 11 To 1 : Screen Hide 1
  961.    Screen 1
  962.    ' Double Buffer screen for no flicker,turn Autoback to manual,turn Update  
  963.    ' off then Update every 2 for smoother animation.
  964.    Double Buffer 
  965.    Autoback 0 : Update Off : Update Every 2
  966.    '
  967.    ' Set the Asteroids starting positions.
  968.    For Z=4 To 9
  969.       AX(Z)=Rnd(272) : AY(Z)=-30 : ADY(Z)=Rnd(230)+250
  970.       Limit Bob Z,48,0 To 272,200
  971.       Bob Z,AX(Z),AY(Z),
  972.    Next Z
  973.    '
  974.    ' Set the Amal channels for the 6 Asteroids.   
  975.    Channel 6 To Bob 4
  976.    Channel 7 To Bob 5
  977.    Channel 8 To Bob 6
  978.    Channel 9 To Bob 7
  979.    Channel 10 To Bob 8
  980.    Channel 11 To Bob 9
  981.    '
  982.    ' Set Amal animation string for an asteroid.   
  983.    F$=F$+"A 0,(71,4)(72,4)(73,4)(74,4)(75,4)(76,4)(77,4)(78,4)(79,4)(80,4)(81,4)(82,4)(83,4)"
  984.    Amal 6,F$ : Amal 7,F$ : Amal 8,F$ : Amal 9,F$ : Amal 10,F$ : Amal 11,F$
  985.    Amal On 
  986.    '
  987.    ' Show Bonus screen. 
  988.    Screen Show 1
  989.    '
  990. End Proc
  991. '
  992. ' Fires the Player ship's lasers.
  993. Procedure _MOVEMISSILE
  994.    '
  995.    If MISSILE=1
  996.       ' Moves the laser upwards. 
  997.       MY=MY-6
  998.       ' Makes player fire one laser at a time. 
  999.       If MY<0
  1000.          MISSILE=0
  1001.          Bob Off 15
  1002.       End If 
  1003.       Bob 15,MX-135,MY-60,70
  1004.    End If 
  1005.    '
  1006.    If Joy(1) and 16
  1007.       ' Delay when you can next fire a laser.
  1008.       If MSLDELAY>20 or MISSILE=0
  1009.          ' Plays the Laser sfx. 
  1010.          Sam Bank 6 : Sam Play %1100,5
  1011.          MISSILE=1
  1012.          ' Sets the laser's starting position to that of the ship.  
  1013.          MX=SX : MY=SY
  1014.          ' Resets the Delay.
  1015.          MSLDELAY=0
  1016.       End If 
  1017.    End If 
  1018.    ' Counting the delay before you can next fire the laser. 
  1019.    MSLDELAY=MSLDELAY+1
  1020.    '
  1021. End Proc
  1022. '
  1023. ' Moves the Asteroids. 
  1024. Procedure ALIENS
  1025.    '
  1026.    ' For..Next loop goes through each asteroid updating it. 
  1027.    For Z=4 To 9
  1028.       If BONUS=0 Then Inc COUNT
  1029.       ' Moves the asteroid.
  1030.       AY(Z)=AY(Z)+ADY(Z)
  1031.       ' Resets asteroid if it reaches the bottom of the screen and increases 
  1032.       ' its speed. 
  1033.       If AY(Z)>230 : AY(Z)=-30 : AX(Z)=Rnd(272) : ADY(Z)=Rnd(Z)+1+(Timer/SPEED) : End If 
  1034.       If AX(Z)<56 : AX(Z)=Rnd(272) : End If 
  1035.       ' Limit Asteroid to the playing area.
  1036.       Limit Bob Z,48,0 To 272,200
  1037.       Bob Z,AX(Z),AY(Z),
  1038.    Next Z
  1039.    '
  1040. End Proc
  1041. '
  1042. ' Checks collision between laser and Asteroids.
  1043. Procedure _MISSCOLLISION
  1044.    '
  1045.    If Bob Col(15,4 To 9)=-1
  1046.       Screen 2
  1047.       ' Update SC and EXSC then convert score to a string to be printed. 
  1048.       SC=SC+25 : EXSC=EXSC+25
  1049.       C$=Str$(SC) : Text 144,20,C$
  1050.       '
  1051.       Screen 1
  1052.       For C=4 To 9
  1053.          ' Checks which Asteroid is hit.
  1054.          If Col(C)=-1
  1055.             ' Turn off laser.
  1056.             Bob Off 15
  1057.             MISSILE=0
  1058.             ' Call EXPLODE procedure.
  1059.             _EXPLODE
  1060.          End If 
  1061.       Next C
  1062.    End If 
  1063.    '
  1064. End Proc
  1065. '
  1066. ' Checks collision between the Player's ship and Asteroids.
  1067. Procedure _SHIPCOLLISION
  1068.    '
  1069.    If Spritebob Col(8,4 To 9)
  1070.       For C=4 To 9
  1071.          ' Checks which asteroid is hit.
  1072.          If Col(C)=-1
  1073.             DELAY=1
  1074.             ' Calls the relevant procedures. 
  1075.             _EXPLODE
  1076.             _SHIPDEATH
  1077.             ' Turn off laser.  
  1078.             MISSILE=0
  1079.             Bob Off 15
  1080.          End If 
  1081.       Next C
  1082.    End If 
  1083.    ' Timer to allow your ship to finish exploding before you exit out of Bonus level.   
  1084.    If DELAY>0 : DELAY=DELAY+1 : End If 
  1085.    If DELAY>12 Then DEAD=1
  1086.    '
  1087. End Proc
  1088. '
  1089. ' Player's Ship explosion animation. 
  1090. Procedure _SHIPDEATH
  1091.    '
  1092.    ' Set explosion bob position to that of the Player's ship. 
  1093.    SDX=X Screen(X Sprite(8)) : SDY=Y Screen(Y Sprite(8))
  1094.    Bob 10,SDX,SDY,
  1095.    Limit Bob 10,48,0 To 272,200
  1096.    ' Set the Amal animation.
  1097.    Channel 13 To Bob 10
  1098.    H$=H$+"A 1,(84,2)(85,2)(86,2)(87,2)(88,2)(89,2)(90,2)(91,2)(92,2)(93,2)(58,2);"
  1099.    Amal 13,H$ : Amal On 13
  1100.    ' Send player ship off screen.   
  1101.    SX=0 : SY=0
  1102.    Sprite Update 
  1103.    Wait Vbl 
  1104.    '
  1105. End Proc
  1106. '
  1107. ' Asteroid explosion animation.
  1108. Procedure _EXPLODE
  1109.    '
  1110.    ' Play Explosion sfx.
  1111.    Sam Bank 6 : Sam Play %11,6
  1112.    ' Sends Asteroid off screen. 
  1113.    AY(C)=240
  1114.    ' Set explosion bob position to that of the Asteroid.  
  1115.    EXX=X Bob(C) : EXY=Y Bob(C)
  1116.    Bob 11,EXX,EXY,
  1117.    Limit Bob 11,48,0 To 272,200
  1118.    ' Set Amal animation.
  1119.    Channel 12 To Bob 11
  1120.    G$=G$+"A 1,(84,2)(85,2)(86,2)(87,2)(88,2)(89,2)(90,2)(91,2)(92,2)(93,2)(58,2);"
  1121.    Amal 12,G$ : Amal On 12
  1122.    '
  1123. End Proc
  1124.