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

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