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

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