LIVES=3 : Rem Stores the amount of lives that Charlie has
COINS=0 : Rem Stores the amount of coins that Charlie has
SCORE=0 : Rem This is Charlies score
_AMOUNT_OF_ENERGY_LEFT=47 : Rem This is the MAXIMUM amount of energy
Dim POCKET(3) : Rem This will hold the numbers of the objects that Charlie is carrying
POCKET(1)=0 : Rem Nothing
POCKET(2)=0 : Rem Nothing
POCKET(3)=0 : Rem Nothing
AMOUNT_OF_OBJECTS=11 : Rem Just set this to the amount of objects that you will have in your game
Dim OBJECT_NAME$(AMOUNT_OF_OBJECTS) : Rem Stores the names of all our in game objects
Dim OBJECT_CURRENT_LOCATION(AMOUNT_OF_OBJECTS) : Rem This will hold the number of the location that the object is currently in during the game
Dim OBJECT_X_OFFSET(AMOUNT_OF_OBJECTS) : Rem This is an X offset for the object so that it sits perfectly in place as they are not all the same size
Dim OBJECT_Y_OFFSET(AMOUNT_OF_OBJECTS) : Rem This is an Y offset for the object so that it sits perfectly in place as they are not all the same size
Dim OBJECT_CURRENT_X_COARDINATE(AMOUNT_OF_OBJECTS) : Rem This is the current X coardinate of the object on screen during the game - Must be diviable by 16 - eg. 16,32,48,64,80,96,112,128.....
Dim OBJECT_CURRENT_Y_COARDINATE(AMOUNT_OF_OBJECTS) : Rem This is the current Y coardinate of the object on screen during the game - Must be diviable by 16 - eg. 16,32.....
Dim OBJECT_SPRITE_IMAGE(AMOUNT_OF_OBJECTS) : Rem This is the image from the sprite bank that we will use to show the object on screen
If Length(2)=0 Then Load "ICONS.ABK" : Rem Is there any ICONS in memory?
If Length(8)=0
FILE$="MAC_5.MAP"
If Exist(FILE$) : Rem Does the file exist?
Open In 1,FILE$ : Rem Open up the file for scanning
THE_LENGTH=Lof(1) : Rem This gets the size of the file
Close 1 : Rem Close the file again
Erase 6 : Rem Get rid of anything thats lying in bank number 6
Reserve As Data 6,THE_LENGTH : Rem Make bank number 6 the same length as the MAP file size
Bload FILE$,Start(6) : Rem Load the MAP file/data into bank number 6 - which is the same size. This is where our MAP will be stored throughout the game.
If Exist(FILE$+".VAL") : Rem Is there any VALUES knocking about? - Yes - then load them in as well!!
Load FILE$+".VAL" : Rem Load the VALUES in.
Else
Erase 8 : Rem Get rid of anything thats lying in bank number 8
Reserve As Data 8,4000 : Rem Make bank number 8 - 4000 bytes long - as thats the same size as our VALUE bank.
End If
If Exist(FILE$+".EFF") : Rem Is there any EFFECTS knocking about? - Yes - then load them in as well!!
Load FILE$+".EFF" : Rem Load the EFFECTS in.
Else
Erase 10 : Rem Get rid of anything thats lying in bank number 10
Reserve As Data 10,Length(6)/2 : Rem Make bank number 10 - half the length of the MAP as it uses bytes not words
End If
End If
End If
If Length(10)=0 Then Load "SCOREPICTURE.ABK"
XMAPSIZE=Deek(Start(6))
YMAPSIZE=Deek(Start(6)+2)
LOCATIONS_IN_MAP=(XMAPSIZE/20)*(YMAPSIZE/12) : Rem This line works out how many different locations there are in the MAP
LOCATION=1 : Rem this variable holds the number of the current location that Charlie is in at any time - we start him at location 1
If Peek(Start(10)+COUNTER)>0 and Peek(Start(10)+COUNTER)<100 Then Poke Start(10)+COUNTER,Peek(Start(10)+COUNTER)+100
Next COUNTER
' *******************************************
' * This next lot sets up the triggers that *
' * will be used to tell wheter or not a *
' * location has any SETUP, PUZZLE CHECKING *
' * or DETECTION CHECKING in it. *
' *******************************************
Dim LOCATION_NAME$(LOCATIONS_IN_MAP) : Rem These variables will store the location names
Dim LOCATION_SETUP_TRIGGERS(LOCATIONS_IN_MAP) : Rem These variables will stores triggers that tell us wheter or not a particular location needs a setup stage
Dim LOCATION_PUZZLE_CHECKING_TRIGGERS(LOCATIONS_IN_MAP) : Rem These variables will stores triggers that tell us wheter or not a particular location needs a puzzle checking stage
Dim LOCATION_DETECTION_CHECKING_TRIGGERS(LOCATIONS_IN_MAP) : Rem These variables will stores triggers that tell us wheter or not a particular location needs a detection checking stage
Restore LOCATION_DATA : Rem This sets the READ pointer so that it starts reading the data from this label name
For COUNTER=1 To LOCATIONS_IN_MAP
Read LOCATION_NAME$(COUNTER) : Rem This stores the name of each location
Read LOCATION_SETUP_TRIGGERS(COUNTER) : Rem This stores the trigger that tells us wheter the location has a setup stage ( a '1' or a '0' )
Read LOCATION_PUZZLE_CHECKING_TRIGGERS(COUNTER) : Rem This stores the trigger that tells us wheter the location has a puzzle checking stage ( a '1' or a '0' )
Read LOCATION_DETECTION_CHECKING_TRIGGERS(COUNTER) : Rem This stores the trigger that tells us wheter the location has a detection checking stage ( a '1' or a '0' )
For N=0 To 31 : Colour N,$0 : Next N : Rem Turn all the colours to black
Gosub _UPDATE_LIVES : Rem Print the amount of lives
Gosub _UPDATE_SCORE : Rem Print the starting score - 000000
Gosub _UPDATE_COINS : Rem Print the amount of coins
Screen 1
Paste Bob 195,38,24 : Rem This is the energy bar
ROOMNAME$=LOCATION_NAME$(LOCATION) : Gosub ROOMNAMEPRINT : Rem Print the current location name
Screen Show 1 : Wait Vbl
Screen Open 0,320,192,32,Lowres : Rem open the screen
Flash Off : Paper 0 : Curs Off : Cls 0 : Hide On : Rem Tidy it up
Get Sprite Palette : Rem get the proper colours
Colour 1,$0
Screen Display 0,,100,, : Rem Display the screen underneath our Score screen
For N=0 To 31 : Colour N,$0 : Next N : Rem Turn all the colours to black
Double Buffer : Rem Set up Double buffer to stop the flickering
Autoback 0 : Rem Set the double buffer mode to 0 - which is the fastest mode
Bob Update Off : Rem Tell AMOS not to automatically update the bobs on screen as we are going to do it ourselves as its more flexible!
Wait Vbl : Rem Wait a 50th of a second
Cls 0 : Rem clear the screen with colour zero
' ********************************************
' * I have added a nice rainbow for the sky. *
' ********************************************
Restore _RAINBOW_DATA
Set Rainbow 0,1,240,"","",""
Rainbow 0,0,96,240
For C=0 To 190
Read CVA
Rain(0,C)=CVA
Next C
_RAINBOW_DATA:
Data $300,$500,$500,$600,$600,$600,$700,$700,$700
Data $800,$800,$800,$900,$900,$900,$A00,$A00,$A00,$B00
Data $B00,$B00,$B00,$B00,$C00,$C00,$D00,$D00,$E10,$E10
Data $E10,$F10,$F20,$F30,$F30,$F40,$F40,$F50,$F60,$F60
Data $F70,$F70,$F80,$F90,$F90,$FA0,$FA0,$FB0,$FC0,$FC0
Data $FD0,$FD0,$FE0,$FF0,$FF0,$FF0,$EF0,$EF0,$DF0,$DF0
Data $DF0,$CF0,$CF0,$BF0,$BF0,$BF0,$AF0,$AF0,$9F0,$9F0
Data $9F0,$8F0,$8F0,$8F0,$8F0,$7F0,$7F0,$7F0,$7F0,$6F0
Data $6F0,$6F0,$4F0,$3F0,$2F0,$2F0,$2F0,$2F0,$2F0,$2F0
Data $2F0,$2F0,$2F0,$2F0,$2F0,$F0,$F0,$F0,$F0,$F0
Data $F0,$F1,$F1,$F2,$F3,$F3,$F4,$F4,$F5,$F6
Data $F6,$F7,$F7,$F8,$F9,$F9,$FA,$FA,$FB,$FC
Data $FC,$FD,$FD,$FE,$FF,$EF,$DF,$DF,$CF,$BF
Data $BF,$AF,$AF,$9F,$8F,$8F,$7F,$7F,$6F,$5F
Data $5F,$4F,$4F,$3F,$2F,$2F,$2F,$2F,$1F,$F
Data $E,$D,$D,$D,$D,$D,$C,$C,$C,$C
Data $B,$B,$B,$B,$B,$B,$A,$A,$A,$A
Data $A,$A,$9,$9,$9,$9,$9,$8,$8,$8
Data $8,$8,$7,$7,$7,$7,$6,$6,$6,$6
Data $5,$5,$5,$5,$4,$4,$4,$3,$3,$3
Set Bob 15,1,, : Rem This sets bob 15 so that the area underneath it won't be saved in memoer once its drawen as we are going to be constantly redrawing the background anyway!
_VALUE1=Peek(Start(8)+CHECKING_ICON1) : Rem This stores the value of the ICON thats underneath the left side of Charlie
_VALUE2=Peek(Start(8)+CHECKING_ICON2) : Rem This stores the value of the ICON thats underneath the right side of Charlie
If(_VALUE1<50 and _VALUE2<50)
FALLING=1
End If
End If
If Jdown(1)
If(JUMPING=0 and FALLING=0)
PRESSED_DOWN=1 : Rem This tells the ladder checking routine that it is to check for a ladder underneath Charlie
PRESSED_UP=0
Gosub CHECK_FOR_LADDER : Rem jump to the checking routine!
End If
End If
If Jup(1) : Rem has joystick been pressed up?
PRESSED_UP=1 : Rem This tells the ladder checking routine to check for a ladder above Charlie
PRESSED_DOWN=0
Gosub CHECK_FOR_LADDER : Rem Jump to the checking routine
If FALLING=0 and JUMPING=0 : Rem is Charlie NOT already jumping or falling?
JUMPING=1 : Rem tell the program that Charlie is jumping
JUMPCOUNTER=JUMPHEIGHT : Rem this sets the JUMPCOUNTER to the height that Charlie can jump. This will be decremented until it reaches 0 and this is how the program knows when to stop jumping!
If STATUS=3
STATUS=STATUS_BACKUP : Rem this is here in case he is tapping his foot
End If
End If
End If
If JUMPING=1 : Rem is Charlie currently jumping?
STANDSTILLCOUNTER=0 : Rem he can't tap his foot in mid air so reset the counter!
_VALUE1=Peek(Start(8)+CHECKING_ICON1) : Rem Stores the value of the ICON to the top left of Charlie
_VALUE2=Peek(Start(8)+CHECKING_ICON2) : Rem Stores the value of the ICON to the top right of Charlie
If(_VALUE1=50 or _VALUE2=50)
JUMPCOUNTER=0
Else
CHARLIEY=CHARLIEY-SPEED : Rem this bit moves Charlie up into the air!
JUMPCOUNTER=JUMPCOUNTER-SPEED : Rem this counts how high Charlie has jumped by taking the speed away from the height that he is allowed to jump - once JUMPCOUNTER reaches 0 it stops jumping!
If CHARLIEY<-6
LOCATION=LOCATION-XMAPSIZE/20
CHARLIEY=162
Gosub ANEWLOCATION
End If
End If
Else
CHARLIEY=CHARLIEY-SPEED : Rem this bit moves Charlie up into the air!
JUMPCOUNTER=JUMPCOUNTER-SPEED : Rem this counts how high Charlie has jumped by taking the speed away from the height that he is allowed to jump - once JUMPCOUNTER reaches 0 it stops jumping!
End If
If JUMPCOUNTER=0 : Rem has Charlie reached the maximum jump height - if he has then set the program to start falling by setting the variable FALLING to 1
JUMPING=0 : Rem turn off jumping
FALLING=1 : Rem turn on falling
End If
If STATUS=1 : Rem is he facing right
CURRENTANIMATIONFRAME=15 : Rem Image for facing to the right when jumping!
End If
If STATUS=2 : Rem is he facing left
CURRENTANIMATIONFRAME=16 : Rem image for facing to the left when jumping!
End If
End If
If FALLING=1 : Rem is Charlie currently falling?
STANDSTILLCOUNTER=0 : Rem he can't tap his foot in mid air so reset the counter!
CHARLIEY=CHARLIEY+SPEED : Rem this bit moves Charlie down until it reaches the ground again!
JUMPCOUNTER=JUMPCOUNTER+SPEED : Rem this counts how far Charlie has falled by adding the speed to JUMPCOUNTER - once JUMPCOUNTER reaches JUMPHEIGHT it stops falling!
If STATUS=1 : Rem is he facing right
CURRENTANIMATIONFRAME=15 : Rem Image for facing to the right when jumping!
End If
If STATUS=2 : Rem is he facing left
CURRENTANIMATIONFRAME=16 : Rem image for facing to the left when jumping!
_VALUE1=Peek(Start(8)+CHECKING_ICON1) : Rem Stores the value of the ICON to the bottom left of Charlie
_VALUE2=Peek(Start(8)+CHECKING_ICON2) : Rem Stores the value of the ICON to the bottom right of Charlie
If(_VALUE1>49 or _VALUE2>49)
FALLING=0 : Rem if he has then turn off the falling routine
CHARLIEANIMATIONCOUNTER=0 : Rem We have to reset this variable back to 0 so that the walk left and right routine works proberly
If STATUS=1
CURRENTANIMATIONFRAME=1 : Rem if Charlie is facing right then when he lands he should be facing right and standing!
End If
If STATUS=2
CURRENTANIMATIONFRAME=7 : Rem if Charlie is facing left then when he lands he should be facing left and standing!
End If
End If
If CHARLIEY>174
LOCATION=LOCATION+XMAPSIZE/20
CHARLIEY=-2
Gosub ANEWLOCATION
End If
End If
End If
If STANDSTILLCOUNTER>1 : Rem Has Charlie not moved for a while
If STATUS<3
STATUS_BACKUP=STATUS : Rem This stores the direction Charlie was facing
End If
STATUS=3 : Rem Tell the program that its currently foottapping
FOOTTAPCOUNTER=FOOTTAPCOUNTER+1 : Rem This measures the amount of time delay for each animation for the foottapping bit
If FOOTTAPCOUNTER=12 : Rem This checks the footapping counter - After foot has been raised and has stayed on the screen for a bit it then has to go back down again
FOOTTAPCOUNTER=0 : Rem Reset the footapping counter to zero
End If
If FOOTTAPCOUNTER<FOOTTAPSPEED : Rem This works out the time delay for the foot animation on the ground
CURRENTANIMATIONFRAME=13 : Rem This is the image to use from the sprite bank for the foot on the ground
End If
If FOOTTAPCOUNTER>=FOOTTAPSPEED : Rem This works out the time delay for the foot raised
CURRENTANIMATIONFRAME=14 : Rem This is the image to use from the sprite bank for the foot raised
End If
End If
If Fire(1) : Rem Has fire been pressed?
If JUMPING=0 and FALLING=0 and STATUS=3 : Rem Check to see that he is not jumping or falling
If _AMOUNT_OF_LOOPS_IN_LOCATION>3 : Rem This just makes sure Charlie is on the screen when ever the inventory screen is called - It prevents a little BUG in the program!!
Gosub INVENTORY : Rem Jump to the routine that handles the INVENTORY
End If
End If
End If
Else
Gosub CLIMB_LADDER : Rem Jumps to the routine that handles Charlie climbing ladders
End If : Rem this is the end of the ladder check
Else
Gosub DEAD : Rem Jumps to the routine that handles Charlie dieing - The Angel
End If : Rem this is the end of the die check
End If : Rem this is the end of the CHEAT=0 check
If CHEAT=1 Then Gosub CHEAT_CHECKS
Bob 15,CHARLIEX+_OFFSET,CHARLIEY,CURRENTANIMATIONFRAME
If(_VALUE1=10 or _VALUE2=10) and(JUMPING=0 and FALLING=0)
If _VALUE1=10
CHARLIEX=((CHARLIEX/16)*16)+16 : Rem Put Charlie on the ladder
End If
If _VALUE2=10
CHARLIEX=((CHARLIEX/16)*16) : Rem Put Charlie on the ladder
End If
LADDER=1 : Rem Tell the rest of the program that Charlies on a LADDER!!
LADDER_ANIMATION_COUNTER=1 : Rem Reset the climbing animation counter
_OFFSET=-3 : Rem This is used to centre Charlie up on the ladder
End If
If _VALUE1=10 and(JUMPING=1 or FALLING=1)
CHARLIEX=((CHARLIEX/16)*16) : Rem Put Charlie on the ladder
JUMPING=0 : Rem Turn off jumping
FALLING=0 : Rem Turn off falling
LADDER=1 : Rem Tell the rest of the program that Charlies on a ladder
LADDER_ANIMATION_COUNTER=1 : Rem Reset the climbing animation counter
_OFFSET=-3 : Rem This is used to centre Charlie up on the ladder
End If
Return
CLIMB_LADDER:
Inc _TIME_ON_THE_LADDER : Rem This is a little timer that I put in. All it does is makes sure Charlie stays on the ladder long enough for you to see him on it. - Just in case you jump off again immediately
CURRENTANIMATIONFRAME=LADDER_ANIMATIONS(LADDER_ANIMATION_COUNTER) : Rem This makes sure Charlie (bob 15) uses the climb animations
If LOCATION_DETECTION_CHECKING_TRIGGERS(LOCATION)=1
CHECKED_DETECTION=0 : Rem We use this to check to see if a detection has been
Gosub "LOCATION_DETECTION"+Str$(LOCATION)-" "
If CHECKED_DETECTION=1 : Rem If a detection has been made then don't call the inventory window - just RETURN
Return
End If
End If
Gosub CHECK_FOR_OBJECT
If POCKET(1)>0 and POCKET(2)>0 and POCKET(3)>0 and OBJECT_TO_BE_PICKED_UP>0
MESSAGE=Rnd(2)+1 : Gosub MESSAGE_PRINTER
Gosub MESSAGE_END
Return
End If
For N=1 To 3
If POCKET(N)=0 : Rem Is POCKET N empty?
POCKET(N)=OBJECT_TO_BE_PICKED_UP : Rem Tell the empty pocket what it should be holding
OBJECT_CURRENT_LOCATION(OBJECT_TO_BE_PICKED_UP)=255 : Rem Place the object in a non existent location - 255 - all objects in here are being carried!
Exit : Rem Once we have filled the pocket we must exit the loop so that the object isn't put into another pocket as well
End If
Next N
WIDTH=240 : Rem Size of the message window
HEIGHT=96 : Rem Heightof the message window
XOFFSET=32 : Rem The X position
YOFFSET=12 : Rem The Y position
Gosub MESSAGEWINDOW : Rem Jump to the routine that will Build the window
For POCKET_NUMBER=1 To 3 : Rem This will check all three pockets!
TY=(22+POCKET_NUMBER*22)+YOFFSET-30 : Rem The Y coardinate for the TEXT to be printed
If POCKET(POCKET_NUMBER)=0 : Rem Is the pocket empty?
TEX$="NOTHING!" : Rem Text is NOTHING!
TX=120+XOFFSET-((Len(TEX$)/2)*8) : Rem This line centres the room name up!!
Gosub PTEXT : Rem Jump to the routine that will display the text
'If the pocket is NOT empty then do this instead:-
Else
TEX$=OBJECT_NAME$(POCKET(POCKET_NUMBER)) : Rem Get the object name
INVENTORY_Y_OFFSET=OBJECT_Y_OFFSET(POCKET(POCKET_NUMBER))/2 : Rem this will place the object perfectly in line with its name text
Paste Bob XOFFSET+34+OBJECT_X_OFFSET(POCKET(POCKET_NUMBER)),TY+INVENTORY_Y_OFFSET-2,OBJECT_SPRITE_IMAGE(POCKET(POCKET_NUMBER)) : Rem This draws the object graphic image in the window beside the text
TX=128+XOFFSET-((Len(TEX$)/2)*8) : Rem This line centres the room name up!!
Gosub PTEXT : Rem Jump to the routine that will display the text
End If
Next POCKET_NUMBER : Rem Has all three pockets been done yet? if not - loop around again
TEX$="EXIT AND DON'T DROP"
TX=44+XOFFSET
TY=(22+POCKET_NUMBER*22)+YOFFSET-30
Gosub PTEXT
MESSAGE=4 : Gosub MESSAGE_PRINTER
HANDSY=4 : Rem Start the HANDS Y position at text line 4 in the INVENTORY window - IE start the hands at the EXIT AND DON'T DROP message
Sprite 10,170,100+HANDSY*22,88 : Rem Place the hand on the left hand side
Sprite 11,405,100+HANDSY*22,89 : Rem Place the hand on the right hand side
Wait Vbl : Rem Give the sprites time to appear
Screen Swap : Wait Vbl : Rem Flip the double buffer screen so that we can see the MENU system that we have just setup
Do
Sprite 10,170,100+HANDSY*22,88 : Rem Place the hand on the left hand side
Sprite 11,405,100+HANDSY*22,89 : Rem Place the hand on the right hand side
If Jup(1) and HANDSY>1 Then HANDSY=HANDSY-1 : Rem Move the hands up!!
If Jdown(1) and HANDSY<4 Then HANDSY=HANDSY+1 : Rem Move the hands down!!
If Fire(1) and HANDSY=1 Then If POCKET(HANDSY)>0 Then POCKET_EMPTIED=HANDSY : Exit : Rem Has object 1 been selected?
If Fire(1) and HANDSY=2 Then If POCKET(HANDSY)>0 Then POCKET_EMPTIED=HANDSY : Exit : Rem Has object 2 been selected?
If Fire(1) and HANDSY=3 Then If POCKET(HANDSY)>0 Then POCKET_EMPTIED=HANDSY : Exit : Rem Has object 3 been selected?
If Fire(1) and HANDSY=4 Then POCKET_EMPTIED=0 : Exit : Rem Has the EXIT AND DON'T DROP message been selected?
Wait 5 : Rem This is the speed at which the hands move up and down at
Loop
If POCKET_EMPTIED>0 : Rem Is there a pocket to be emptied?
PUZZLE_SOLVED=0
If LOCATION_PUZZLE_CHECKING_TRIGGERS(LOCATION)=1 : Rem Is there a PUZZLE on this screen?
Gosub "LOCATION_PUZZLE_CHECKING"+Str$(LOCATION)-" " : Rem Check out the PUZZLE
End If
If PUZZLE_SOLVED=0
OBJECT_CURRENT_LOCATION(POCKET(POCKET_EMPTIED))=LOCATION : Rem Place the object dropped in the current location
WHERE_YOU_ARE_X=((CHARLIEX+10)/16)*16 : Rem Find out the X coardinate of the middle of Charlie on the screen to the nearest 16 pixels!
WHERE_YOU_ARE_Y=((CHARLIEY+30)/16)*16 : Rem Find out the Y coardinate of Charlies feet to the nearest 16 pixels!
OBJECT_CURRENT_X_COARDINATE(POCKET(POCKET_EMPTIED))=WHERE_YOU_ARE_X : Rem Place the Object to be dropped at Charlies X coardinates
OBJECT_CURRENT_Y_COARDINATE(POCKET(POCKET_EMPTIED))=WHERE_YOU_ARE_Y : Rem Place the object to be dropped at Charlis Y coardinates
POCKET(POCKET_EMPTIED)=0 : Rem empty the pocket
End If
End If
Gosub THE_LOCATION_PICTURE_MAKER : Rem Jump to the routine that will redraw the picture after the INVENTORY window disappears
Sprite Off 10 : Sprite Off 11 : Rem Turn off the hands
Unfreeze : Rem Unfreeze all the game action - IE restart all monsters and animating backgrounds
Screen Copy 2 To 0 : Rem Redraw the background by copying the entire contents of screen 2 to screen 0
Return : Rem Go back to where we were called from!
CHECK_FOR_OBJECT:
WHERE_YOU_ARE_X=((CHARLIEX+10)/16)*16 : Rem Find out the X coardinate of the middle of Charlie on the screen to the nearest 16 pixels!
WHERE_YOU_ARE_Y=((CHARLIEY+30)/16)*16 : Rem Find out the Y coardinate of Charlies feet to the nearest 16 pixels!
OBJECT_TO_BE_PICKED_UP=0 : Rem Reset this variable
For N=1 To AMOUNT_OF_OBJECTS : Rem We need to check through all the objects in the game to see if any of them are at Charlies feet!
If OBJECT_CURRENT_LOCATION(N)=LOCATION
' *************************
' * Check Charlie's feet! *
' *************************
If OBJECT_CURRENT_X_COARDINATE(N)=WHERE_YOU_ARE_X and OBJECT_CURRENT_Y_COARDINATE(N)=WHERE_YOU_ARE_Y : Rem Is the object at the same coardinates as Charlie
OBJECT_TO_BE_PICKED_UP=N : Rem This is the object to be picked up then
End If
' ****************************************
' * Check to the left of Charlie's feet! *
' ****************************************
If OBJECT_TO_BE_PICKED_UP=0 and OBJECT_CURRENT_X_COARDINATE(N)=WHERE_YOU_ARE_X-16 and OBJECT_CURRENT_Y_COARDINATE(N)=WHERE_YOU_ARE_Y
OBJECT_TO_BE_PICKED_UP=N : Rem This is the object to be picked up then
End If
' *****************************************
' * Check to the right of Charlie's feet! *
' *****************************************
If OBJECT_TO_BE_PICKED_UP=0 and OBJECT_CURRENT_X_COARDINATE(N)=WHERE_YOU_ARE_X+16 and OBJECT_CURRENT_Y_COARDINATE(N)=WHERE_YOU_ARE_Y
OBJECT_TO_BE_PICKED_UP=N : Rem This is the object to be picked up then
End If
End If
Next N : Rem Has all objects been checked? If not then continue the loop
Return : Rem Go back to where we were called from!
TEX$=Upper$(TEX$) : Rem Convert our piece of text into UPPERCASE (Capital) letters
WHATLENGTH=Len(TEX$) : Rem this line finds the amount of characters that is in our message
For N=1 To WHATLENGTH : Rem this tells the routine how many characters it has to print.
TEX2$=Mid$(TEX$,N,1) : IMAGE=Asc(TEX2$) : Rem this bit converts the current letter into the number of the image in our sprite bank
If IMAGE=33 Then IMAGE=76+19 : Rem !
If IMAGE=46 Then IMAGE=74+19 : Rem .
If IMAGE=39 Then IMAGE=72+19 : Rem '
If IMAGE=63 Then IMAGE=75+19 : Rem ?
If IMAGE=44 Then IMAGE=73+19 : Rem ,
If IMAGE=32 Then Paste Bob TX+(N*TWIDTH),TY,_FONTSTART+31 : Rem This finds the SPACE in your message
If IMAGE<>32 and(IMAGE<48 or IMAGE>57) Then Paste Bob TX+(N*TWIDTH),TY,(IMAGE-64)+_FONTSTART-1 : Rem This finds the LETTERS in your message
If(IMAGE>=48 and IMAGE<=57) Then Paste Bob TX+(N*TWIDTH),TY,IMAGE-21+_FONTSTART-27 : Rem This finds the NUMBERS in your message
Next N : Rem have we reached the end of the message yet?
Return : Rem go back to the next command after where the routine was called from - IE the gosub PTEXT
ROOMNAMEPRINT:
NUMBEROFSPACES=20-Len(ROOMNAME$) : Rem this checks to see how long the roomname is - must be at least 20 characters in length!
ROOMNAME$=ROOMNAME$+Space$(NUMBEROFSPACES) : Rem If the roomname is less than 20 characters then add enough spaces to make it up to 20 characters!
TEX$=ROOMNAME$ : Rem Set the variable TEX$ to the same as ROOMNAME$ so that its compatible with the PTEXT routine
Screen 1 : Rem All future output to screen 1
TX=116 : TY=13 : Rem Its Y coardinates are 17
Gosub PTEXT : Rem go to the routine that prints it!!
Screen 0 : Rem All future output to screen 0
Return
DISPLAY_OBJECTS_IN_LOCATION:
For N=1 To AMOUNT_OF_OBJECTS : Rem Go through all the objects in the game
If OBJECT_CURRENT_LOCATION(N)=LOCATION : Rem Is object N in this location?
Paste Bob OBJECT_CURRENT_X_COARDINATE(N)+OBJECT_X_OFFSET(N),OBJECT_CURRENT_Y_COARDINATE(N)+OBJECT_Y_OFFSET(N),OBJECT_SPRITE_IMAGE(N) : Rem If it is then place it on the screen at the proper X and Y coardinates!