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

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