home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Merciful 3
/
Merciful_Release_3.bin
/
software
/
h
/
henrys_house
/
henryshouse1.dms
/
henryshouse1.adf
/
SourceCode
/
SelectLevel.Asc
< prev
next >
Wrap
Text File
|
1993-06-20
|
19KB
|
591 lines
' Henry's House
'
' SELECT LEVEL SOURCE CODE
'
' by : Gurmita & Sucha Singh
'
'-----------------------------------------------------------------------------
' NOTE:This source code can not be Run through the AMOS editor as some files
' need to be copied into memory which is done in the startup-sequence of the
' Game(see Intro source code).
'
' The following source code reseaves the Main variables LIVES,SC,EXSC and
' LEVEL.It then displays the doors depending on which level you have just come
' from then waits until you have picked a level.
'
' Memory Banks Used:
' 1 - Sprites - Sprites
' 5 - Sound - Main samples
' 10 - Pac Pic - House background
' 11 - Pac Pic - Level 1 loading picture
' 12 - Pac Pic - Level 2 loading picture
' 13 - Pac Pic - Level 3 loading picture
' 14 - Pac Pic - Level 4 loading picture
' 15 - Pac Pic - Level 5 loading picture
'
' Bobs and Sprites Used:
' Bob 1 - Level 1 door
' Bob 2 - Level 2 door
' Bob 3 - Level 3 door
' Bob 4 - Level 4 door
' Bob 5 - Level 5 door
' Sprite 8 - Player
'
' Variables Used:
' X - Player sprites x coordinates.
' Y - Player sprites y coordinates.
' I - Player sprite Image.
' D - Start direction image for player.
' BLINK - Time taken for player to start blinking if left alone.
' F - The platform colour which you collide with.
' N - The current height of Henry when jumping.
' SC - Your current score.
' EXSC - Increases with your score but gets set to 0 if it equals 2000 when
' you get an extra life.
' LEVEL - The level number which effects the images of the doors.
' LIVES - Number of lives Henry has.
'
'-----------------------------------------------------------------------------
'
' Closes the AMOS editor to save memory.
Close Editor
'
' Makes the variables global so the whole program can access them.
Global X,Y,I,D,F,N,SC,EXSC,LEVEL,LIVES,BLINK
'
'Sets the variables
X=310 : Y=187 : I=1 : D=0 : BLINK=0
'
'-----------------------------------------------------------------------------
' Calls the SETUP procedure.
_SETUP
'
' Creates a mask for the sprites,sets Autoback to manual,turns off the
' automatic updating and updates every 2 vertical blank periods to make the
' Amal animations smoother.
Make Mask : Autoback 0 : Update Off : Update Every 2
'
'-----------------------------------------------------------------------------
' Calls the BLINK procedure.
_BLINK
'
' Calls the MAINLOOP procedure.
_MAINLOOP
'-----------------------------------------------------------------------------
'
' Uses Screen Swap which updates everything at once so making the Game run
' faster.Checks for collisions,the joystic and the platforms.
Procedure _MAINLOOP
'
' Manualy updates all the bobs so there is no flicker at the start.
Bob Clear : Bob Draw
'
' The loop is divided into two parts. The first is used to perform the
' various instructions in your program and the secound part repeats the
' above contents.This keeps the loop in sync.
Do
' Swaps between the Phisical and Logical screens then clears the screen
' of bobs.
Screen Swap 0
Wait Vbl
Bob Clear
'
' Sets the Joystic.
J=Joy(1)
'
' Checks the collision between you and the 5 doors.If the image is of a
' blank door and you press fire on it then you go to the relevant procedure.
If I Bob(1)=16 and J=16 and Spritebob Col(8,1 To 1) Then _LEVEL_ONE
If I Bob(2)=16 and J=16 and Spritebob Col(8,2 To 2) Then _LEVEL_TWO
If I Bob(3)=16 and J=16 and Spritebob Col(8,3 To 3) Then _LEVEL_THREE
If I Bob(4)=16 and J=16 and Spritebob Col(8,4 To 4) Then _LEVEL_FOUR
If I Bob(5)=16 and J=16 and Spritebob Col(8,5 To 5) Then _LEVEL_FIVE
'
' Checks for the joystic and floor,so if Henry is left alone on a
' platform the variable 'BLINK' increases or else it equals 0.
If J=0 and F=2 Then Inc BLINK Else BLINK=0
'
' If BLINK is greater than 20(amount of time to stand still before Henry
' starts to blink) then it calls the BLINK procedure.
If BLINK>20 Then _BLINK
'
' Checks Left & Right joystic directions.If the joystic has been moved
' and Henry is away from the edge then he will either move left or right.
' The variable D sets the starting frame depending on the joystic direction
' you have moved.It then adds the frames to make Henry look like he is walking.
If J=4 and X>154 Then Dec X : D=6 : Inc C : If C mod 4=0 Then Add I,1,1 To 6
If J=8 and X<424 Then Inc X : D=0 : Inc C : If C mod 4=0 Then Add I,1,1 To 6
'
' Checks for Up,Up left and Up right directions.If the joystic has been
' moved in either of the up directions and Henry is on the platform then
' the relevant JUMP procedure is called.
If J=1 and F=2 Then JUMP_UP
If J=5 and F=2 Then D=6 : JUMP_LEFT
If J=9 and F=2 Then D=0 : JUMP_RIGHT
'
' Checks for a collision between a colour on screen and the player sprite.
F=Point(X Screen(X Sprite(8)),Y Screen(Y Sprite(8)))
'
' If the colour is not equal to 2(the platform colour) then Henry will fall.
If F<>2 Then Inc Y
'
' Updates the player sprite and draws all the bobs on screen.
Sprite 8,X,Y,I+D
Sprite Update
Bob Draw
'
'-----------------------------------------------------------------------
' Swaps between the Phisical and Logical screens then clears the screen
' of bobs.
Screen Swap 0
Wait Vbl
Bob Clear
J=Joy(1)
'
' Checks for the joystic.By repeating it again it makes Henry walk faster.
If J=4 and X>154 Then Dec X : D=6 : Inc C : If C mod 4=0 Then Add I,1,1 To 6
If J=8 and X<424 Then Inc X : D=0 : Inc C : If C mod 4=0 Then Add I,1,1 To 6
'
' Checks for the collision between Henry and the platforms.
F=Point(X Screen(X Sprite(8)),Y Screen(Y Sprite(8)))
If F<>2 Then Inc Y
'
' Updates the player sprite and draws the bobs on screen.
Sprite 8,X,Y,I+D
Sprite Update
Bob Draw
Loop
'
' Basic Main loop structure used in the Game:
'
' Double buffer }
' Autoback 0 } Sets the automatic updating system off.
' Update Off }
'
' Do
' Screen Swap }
' Wait Vbl } Swaps between phisical & logical screens.
' Bob Clear }
'
' Your program contents.
'
' Bob Draw
'
' Screen Swap }
' Wait Vbl } Swaps between phisical & logical screens.
' Bob Clear }
'
' Repeat contents.
'
' Bob Draw
' Loop
'
End Proc
'
' Opens up a screen,sets the fonts,reseaves the variables from the last
' program then loads the bobs and sfx and sets up the images for the doors.
Procedure _SETUP
'
' Hides mouse pointer,opens screen 0 and hides it.
Hide On
Screen Open 0,320,30,32,Lowres : Screen Hide 0
Curs Off : Flash Off : Cls 0
'
' Loads fonts from Disk2 then checks all the fonts.
Get Disc Fonts
Screen 0
For F=0 To 6
Set Font F : T$="Amos 12345:"+Str$(F)
Text 0,0,T$
Next F
Cls 0
'
' Reseaves the command line$ then separates its contents into the 4 strings.
Set Font 6
A$=Left$(Command Line$,3)
B$=Mid$(Command Line$,4,6)
C$=Mid$(Command Line$,10,5)
D$=Right$(Command Line$,1)
'
' Converts the 4 strings into variables.
LIVES=Val(A$) : SC=Val(B$) : EXSC=Val(C$) : LEVEL=Val(D$)
'
' Prints the Lives,Score and Time onto the control panel.
If LIVES<10 Then Ink 2,0 : Text 39,20,B$ : Text 144,20,C$
If LIVES>9 Then Ink 2,0 : Text 27,20,B$ : Text 144,20,C$
Ink 2,0 : Text 288,20,"80"
'
' Loads the powerpacked bobs and sfx.
Screen 0
'Ppload "Henry's_HouseD2:Bobs/SpritesSelect"
'Ppload "Henry's_HouseD2:Sound/Mainsfx",5
'
' Unpacks the background to screen 0,hides it then gets the sprite palette
' and double buffers the screen.
Unpack 10 To 0 : Screen Hide 0
Get Sprite Palette : Double Buffer
'
' Sets the hot spot to bottom centre for the player sprites.
For N=1 To 12 : Hot Spot N,$12 : Next
'
' Calls the SETDOORS procedure.
_SETDOORS
'
' Fades the background to black then fades up the picture to its original colours.
Fade 1 : Wait 15
Screen Show 0
Fade 1,$0,$BBB,$831,$C97,$A60,$951,$632,$5A,$61,$81,$A1,$897,$776,$665,$444,$333,$34,$0,$888,$FFF,$520,$840,$B70,$FB0,$486,$5A8,$5CA,$8E,$8,$A01,$D01,$EC8
Wait 15
'
' Sets the volume for all channels to maximum and updates the bobs.
Volume %1111,63
Bob Clear : Bob Draw
'
End Proc
'
' Makes Henry Jump up.
Procedure JUMP_UP
'
' Play the jumping sfx.
Sam Play %1100,5
'
' First 'for next' loop makes Henry move up.
For N=1 To 26
Dec Y
Sprite 8,X,Y,I+D
Update
Wait Vbl
Next
'
' Secound loop makes Henry come down and checks for collision with any
' platforms.
For N=1 To 26
F=Point(X Screen(X Sprite(8)),Y Screen(Y Sprite(8)))
If F<>2 Then Inc Y
' If Henry touches a platform before he has finished coming down then
' it exits out of the for next loop by making N=26.
If F=2 Then N=26
Sprite 8,X,Y,I+D
Update
Wait Vbl
Next
'
' Reset 'N' variable and clear the bobs to keep in sync with mainloop.
N=1
Bob Clear
'
End Proc
'
' Makes Henry Jump up and left.
Procedure JUMP_LEFT
'
' Play the jumping sfx.
Sam Play %1100,5
'
' First 'for next' loop makes Henry move up and left.
For N=1 To 26
Add I,1,1 To 6 : Dec Y : If X>154 Then Dec X
Sprite 8,X,Y,I+D
Update
Wait Vbl
Next N
'
' Secound loop makes Henry come down and move left while checking for
' collisions with any platforms.
For N=1 To 26
F=Point(X Screen(X Sprite(8)),Y Screen(Y Sprite(8)))
Add I,1,1 To 6 : If X>154 Then Dec X
If F<>2 Then Inc Y
' If Henry touches a platform before he has finished coming down then
' it exits out of the for next loop by making N=26.
If F=2 Then N=26
Sprite 8,X,Y,I+D
Update
Wait Vbl
Next N
'
' Reset 'N' variable and clear the bobs to keep in sync with mainloop.
N=1
Bob Clear
'
End Proc
'
' Makes Henry Jump up and right.
Procedure JUMP_RIGHT
'
' Play the jumping sfx.
Sam Play %1100,5
'
' First 'for next' loop makes Henry move up and right.
For N=1 To 26
Add I,1,1 To 6 : Dec Y : If X<424 Then Inc X
Sprite 8,X,Y,I+D
Update
Wait Vbl
Next
'
' Secound loop makes Henry come down and move right while checking for
' collisions with any platforms.
For N=1 To 26
F=Point(X Screen(X Sprite(8)),Y Screen(Y Sprite(8)))
Add I,1,1 To 6 : If X<424 Then Inc X
If F<>2 Then Inc Y
' If Henry touches a platform before he has finished coming down then
' it exits out of the for next loop by making N=26.
If F=2 Then N=26
Sprite 8,X,Y,I+D
Update
Wait Vbl
Next
'
' Reset 'N' variable and clear the bobs to keep in sync with mainloop.
N=1
Bob Clear
'
End Proc
'
' Makes Henry start blinking.
Procedure _BLINK
'
' Set the Amal animation of Henry blinking and turn the automatic updating on.
Channel 1 To Sprite 8
Sprite 8,X,Y,
A$="A 0,(13,30)(14,10)(13,10)(14,10);"
Amal 1,A$ : Amal On 1 : Update On
'
' Small loop which repeats itself until you move Henry.
Do
' Set joystic and check for collisions between the player and doors.
J=Joy(1)
If I Bob(1)=16 and J=16 and Spritebob Col(8,1 To 1) Then _LEVEL_ONE
If I Bob(2)=16 and J=16 and Spritebob Col(8,2 To 2) Then _LEVEL_TWO
If I Bob(3)=16 and J=16 and Spritebob Col(8,3 To 3) Then _LEVEL_THREE
If I Bob(4)=16 and J=16 and Spritebob Col(8,4 To 4) Then _LEVEL_FOUR
If I Bob(5)=16 and J=16 and Spritebob Col(8,5 To 5) Then _LEVEL_FIVE
'
' Check for any joystic movement then exits out of loop.
If J>0 Then Exit
' Wait for a vertical blank.
Wait Vbl
Loop
'
' Turns off blinking animation,automatic updateing and resets the BLINK timer.
Amal Off 1 : Update Off : BLINK=0
'
' Updates the bobs,swaps the screen and then clears the bobs on screen.This
' is so the program can stay in sync when returning to mainloop.
Bob Clear : Bob Draw : Screen Swap 0 : Wait Vbl : Bob Clear
'
End Proc
'
' Reverses the player images to make Henry's left facing images.
Procedure _REVERSESPRITES
'
' Goes through the image of player,gets the image,sets the hot spot then
' pastes the fliped image.
For N=1 To 6
Bob 1,16,27,N : Wait Vbl : Get Bob N+6,9,1 To 25,28
Hot Spot N+6,$12 : Paste Bob 500,500,Hrev(N+6)
Next : Bob Off 1 : Wait Vbl
'
End Proc
'
' Sets the images for the doors depending on the LEVEL variable.
Procedure _SETDOORS
'
' Each 'If' statement holds the different combinations of door images which
' are changed when you choose a level.
' If the bobs image=15 then the door has the 'No Entry' sign on it and can
' not be opened.
' If the bobs image=16 then the door has no sign on it so you can open it.
' If the bobs image=18 then the door has a tick on it meaning you have
' finished that level.
If LEVEL=0
Bob 1,217,117,16
Bob 2,139,117,16
Bob 3,143,53,15
Bob 4,232,53,15
Bob 5,72,178,15
End If
If LEVEL=1
Bob 1,217,117,18
Bob 2,139,117,16
Bob 3,143,53,15
Bob 4,232,53,15
Bob 5,72,178,15
End If
If LEVEL=2
Bob 1,217,117,16
Bob 2,139,117,18
Bob 3,143,53,15
Bob 4,232,53,15
Bob 5,72,178,15
End If
If LEVEL=3
Bob 1,217,117,18
Bob 2,139,117,18
Bob 3,143,53,16
Bob 4,232,53,16
Bob 5,72,178,15
End If
If LEVEL=4
Bob 1,217,117,18
Bob 2,139,117,18
Bob 3,143,53,18
Bob 4,232,53,16
Bob 5,72,178,15
End If
If LEVEL=5
Bob 1,217,117,18
Bob 2,139,117,18
Bob 3,143,53,16
Bob 4,232,53,18
Bob 5,72,178,15
End If
If LEVEL=6
Bob 1,217,117,18
Bob 2,139,117,18
Bob 3,143,53,18
Bob 4,232,53,18
Bob 5,72,178,16
End If
'
End Proc
'
' The following procedures each opens the door to their level,shows their
' loading picture,sends the main variables and loads their particular level.
Procedure _LEVEL_ONE
'
' Note:This source code applies to the other LEVEL procedures.
'
' Resets joystic,changes the door image to that of an opened one then plays
' the DoorOpen sfx.
J=0
Bob 1,,,17 : Bob Update
Sam Play %1110,1
'
' Fades the screen,turns off all the sprites and bobs then hides screen 0.
Wait 10 : Fade 2 : Wait 30 : Bob Off : Sprite Off : Sprite Update : Wait Vbl : Screen Hide 0
'
' Sets the level variable so when you come back the correct doors are opened.
If LEVEL=2 Then LEVEL=3 Else LEVEL=1
'
' Unpacks the level loading picture to screen 1,hides it,fades it to
' black then fades it into view.
Unpack 11 To 1 : Screen Hide 1
Fade 1 : Wait 15
Screen Show 1
Fade 1,$0,$FFF,$777,$BBB,$B70,$950,$730,$520,$62,$82,$A3,$B4,$9C4,$FB0,$256,$0
Wait 15
'
'
' Create 4 Main strings to hold the 4 main variables(LIVES,SC,EXSC,LEVEL).
A$=" " : B$=" " : C$=" " : D$=" "
'
' Convert the 4 variables into strings.
L$=Str$(LIVES) : S$=Str$(SC) : E$=Str$(EXSC) : LEV$=Str$(LEVEL)
'
' Then place those strings into the above Main strings.
Right$(A$,3)=L$ : Left$(B$,6)=S$ : Right$(C$,5)=E$ : Right$(D$,2)=LEV$
'
' Lastly it places the final 4 strings into the Command Line$ to be passed
' through to the next program.
Command Line$=A$+B$+C$+D$
'
' Turn off all amal animations,close screen 0,erase all memory banks then
' load the Level.
Amal Off
Screen Close 0
For BANK=0 To 15 : Erase BANK : Next BANK
Run "HenryGame/level1"
'
End Proc
'
Procedure _LEVEL_TWO
J=0
Bob 2,,,17 : Bob Update
Sam Play %1110,1
Wait 10 : Fade 2 : Wait 30 : Bob Off : Sprite Off : Sprite Update : Wait Vbl : Screen Hide 0
If LEVEL=1 Then LEVEL=3 Else LEVEL=2
Unpack 12 To 1 : Screen Hide 1
Fade 1 : Wait 15
Screen Show 1
Fade 1,$0,$FFF,$CCC,$888,$D80,$B60,$940,$730,$520,$5BD,$49B,$378,$256,$244,$543,$0
Wait 15
'
A$=" " : B$=" " : C$=" " : D$=" "
L$=Str$(LIVES) : S$=Str$(SC) : E$=Str$(EXSC) : LEV$=Str$(LEVEL)
Right$(A$,3)=L$ : Left$(B$,6)=S$ : Right$(C$,5)=E$ : Right$(D$,2)=LEV$
Command Line$=A$+B$+C$+D$
Amal Off
Screen Close 0
For BANK=0 To 15 : Erase BANK : Next BANK
Run "HenryGame/level2"
End Proc
'
Procedure _LEVEL_THREE
J=0
Bob 3,,,17 : Bob Update
Sam Play %1110,1
Wait 10 : Fade 2 : Wait 30 : Bob Off : Sprite Off : Sprite Update : Wait Vbl : Screen Hide 0
If LEVEL=5 Then LEVEL=6 Else LEVEL=4
Unpack 13 To 1 : Screen Hide 1
Fade 1 : Wait 15
Screen Show 1
Fade 1,$0,$FFF,$777,$BBB,$CA8,$B86,$A74,$963,$752,$641,$530,$45,$256,$67,$78,$0
Wait 15
'
A$=" " : B$=" " : C$=" " : D$=" "
L$=Str$(LIVES) : S$=Str$(SC) : E$=Str$(EXSC) : LEV$=Str$(LEVEL)
Right$(A$,3)=L$ : Left$(B$,6)=S$ : Right$(C$,5)=E$ : Right$(D$,2)=LEV$
Command Line$=A$+B$+C$+D$
Amal Off
Screen Close 0
For BANK=0 To 15 : Erase BANK : Next BANK
Run "HenryGame/level3"
End Proc
'
Procedure _LEVEL_FOUR
J=0
Bob 4,,,17 : Bob Update
Sam Play %1110,1
Wait 10 : Fade 2 : Wait 30 : Bob Off : Sprite Off : Sprite Update : Wait Vbl : Screen Hide 0
If LEVEL=4 Then LEVEL=6 Else LEVEL=5
Unpack 14 To 1 : Screen Hide 1
Fade 1 : Wait 15
Screen Show 1
Fade 1,$0,$FFF,$777,$BBB,$6DE,$5BC,$5AA,$499,$578,$256,$FE5,$FC4,$FB4,$D83,$A62,$0
Wait 15
'
A$=" " : B$=" " : C$=" " : D$=" "
L$=Str$(LIVES) : S$=Str$(SC) : E$=Str$(EXSC) : LEV$=Str$(LEVEL)
Right$(A$,3)=L$ : Left$(B$,6)=S$ : Right$(C$,5)=E$ : Right$(D$,2)=LEV$
Command Line$=A$+B$+C$+D$
Amal Off
Screen Close 0
For BANK=0 To 15 : Erase BANK : Next BANK
Run "HenryGame/level4"
End Proc
'
Procedure _LEVEL_FIVE
J=0
Bob 5,,,17 : Bob Update
Sam Play %1110,1
Wait 10 : Fade 2 : Wait 30 : Bob Off : Sprite Off : Sprite Update : Wait Vbl : Screen Hide 0
LEVEL=0
Unpack 15 To 1 : Screen Hide 1
Fade 1 : Wait 15
Screen Show 1
Fade 1,$0,$FFF,$777,$BBB,$986,$875,$765,$654,$544,$388,$256,$B55,$955,$9A5,$785,$0
Wait 15
'
A$=" " : B$=" " : C$=" " : D$=" "
L$=Str$(LIVES) : S$=Str$(SC) : E$=Str$(EXSC) : LEV$=Str$(LEVEL)
Right$(A$,3)=L$ : Left$(B$,6)=S$ : Right$(C$,5)=E$ : Right$(D$,2)=LEV$
Command Line$=A$+B$+C$+D$
Amal Off
Screen Close 0
For BANK=0 To 15 : Erase BANK : Next BANK
Run "HenryGame/level5"
End Proc