"Haunted house" for Sharp PC-1500 +8KB.
Author : Kevin Lowey
Unpublished.
CLOAD "HAUNTED HOUSE"
RUN
Game: It is a haunted house game I wrote over Christmas in 1984. Vampires, attacking cats, mysterious caverns, musical rooms, a lot of fun. The layout of the house is based mainly on my parent's house. It is similar to the "Adventure" game on Unix, in that you move around in directions, pick up items to use later, etc. There is a time limit (vampires come out at midnight and kill you), so there is only one way through the game that lets you finish. The fastest I saw anyone finish it was in about 2.5 hours. It requires the 8K expansion module, and uses all of it. Only 392 bytes are free after it is loaded. K.L.
BASIC program.
7 "HAUNTED HOUSE
5 ARUN :PAUSE "(C) KEVIN LOWEY-1984
10 "DRIVER"LOCK :RANDOM :WAIT 100:INPUT "PLAY GAME? ";Y$:GOSUB "%1ST":IF Y$="N"END
20 IF N>0INPUT "CONTINUE PREVIOUS GAME? ";Y$:GOSUB "%1ST":IF Y$="Y"GOTO "%START
30 PRINT "H Gives Instructions":RESTORE
40 CLEAR :BEEP ON :N=1:T=7:READ K:K=K-1:DIM K$(K)*1:FOR Z=0TO K
50 READ K$(Z):NEXT Z:READ S:S=S-1:DIM S(S,1),S$(S):FOR Z=0TO S:READ S$(Z),S(Z,0),S(Z,1)
60 S(Z,1)=-S(Z,1):NEXT Z:L=5000
200 "%START"G=0:RESTORE L:READ R:IF R<>0GOSUB R
210 IF G=1GOTO "%START
220 IF G=2GOTO "%COMM
230 READ D$:PRINT "You are at ";D$;".":FOR Z=1TO 6:READ @(Z):IF @(Z)<>0READ @$(Z)
240 NEXT Z:IF O=1GOTO "%OBJECTS
250 FOR Z=1TO 6:IF @(Z)<>0PRINT K$(Z-1);": is ";@$(Z);".
260 NEXT Z
270 "%OBJECTS"FOR Z=0TO S
280 IF S(Z,0)=LTHEN PRINT "You see ";S$(Z);".
290 NEXT Z:RESTORE 4100:READ V:FOR Z=1TO V:READ V$:GOSUB V$:NEXT Z
300 "%COMM"Y$="":INPUT "NEXT:";Y$:GOSUB "%1ST":K$=Y$
310 WAIT 100:Z=0
320 IF K$(Z)<>K$LET Z=Z+1:IF Z<=KGOTO 320
330 IF Z>KBEEP 2:PAUSE "BAD COMMAND":GOTO "%COMM
340 GOSUB K$:IF G=2GOTO "%COMM
350 GOTO "%START
400 "%Q"POKE 24552,72,118,74,0,5,189,255,65,78,78,153,8
410 POKE 24564,76,119,139,6,72,119,74,0,158,18,154
420 PRINT " You were killed!":GOSUB "%MU
430 WAIT 0:FOR Y=1TO 20:FOR X=1TO 10:NEXT X
440 CALL 24552:NEXT Y:WAIT 200:GOSUB "P":N=0:GOTO 10
500 "%MU"BEEP 1,104,400:BEEP 1,91,150:BEEP 1,85,300:BEEP 1,104,250:BEEP 1,70,1200:RETURN
600 "%1ST"Y$=LEFT$ (Y$,1):RETURN
1000 DATA 17,"N","S","E","W","U","D","I","T","L","P","R","G","Q","H","B
1010 DATA "VAM","FRI
1100 "T"G=2:PRINT "Game time is";USING "###.##";T
1110 X=TIME /100:X=X-INT X:X=X*100:IF X>12LET X=X-12
1120 IF X<1LET X=X+12
1130 PRINT "Real time is";X
1140 USING :RETURN
1200 "H"WAIT 200:PRINT "N,S,E,W,U,D: Directions":PRINT "G:Get object":PRINT "L:Leave object
1210 PRINT "I:Inventory":PRINT "T:Time":PRINT "P:Points":PRINT "R:Repeat long description
1220 PRINT "Q:Quick description":PRINT "B:No Beeps
1230 WAIT 100:G=2:RETURN
1300 "R"O=0:G=1:RETURN
1400 "B"PRINT "Beep is now off":BEEP OFF :G=2:RETURN
1500 "Q"O=1:G=1:RETURN
1600 "P"G=2:I=0:J=0:FOR Y=0TO S:J=J+ABS S(Y,1)*100
1610 IF S(Y,1)>0LET I=I+100*S(Y,1)
1620 NEXT Y:J=J+400:I=I+P:PRINT "You have";I;"/";J;" Points":RETURN
1700 "N"M=1:GOSUB "%M":RETURN
1710 "S"M=2:GOSUB "%M":RETURN
1720 "E"M=3:GOSUB "%M":RETURN
1730 "W"M=4:GOSUB "%M":RETURN
1740 "U"M=5:GOSUB "%M":RETURN
1750 "D"M=6:GOSUB "%M":RETURN
1760 "%M"G=0:T=T+.05:IF T-INT T>=.6LET T=T+.4
1770 IF @(M)=0PAUSE "You cannot move there.":G=2:T=T-.05:RETURN
1780 H=L:L=@(M):RETURN
1800 "G"G=2:X=0:FOR Y=0TO S:IF S(Y,0)=-1LET X=X+1
1810 NEXT Y:IF X=3PRINT "You have too much!":RETURN
1820 INPUT "Get what? ";T$:Y=0
1830 IF Y<=SIF S$(Y)<>T$LET Y=Y+1:GOTO 1830
1840 IF Y=S+1BEEP 2:PRINT "There is no such object!":RETURN
1850 IF S(Y,0)=-1PRINT "You are carrying ";T$:RETURN
1860 IF S(Y,0)<>LBEEP 2:PRINT T$;" is not here":RETURN
1870 IF S$(Y)=T$LET S(Y,0)=-1:S(Y,1)=ABS S(Y,1):GOSUB "I
1880 RETURN
1900 "L"GOSUB "I":INPUT "Leave what? ";L$:G=2:Y=0
1910 IF Y<=SIF S$(Y)<>L$LET Y=Y+1:GOTO 1910
1920 IF Y>SBEEP 1:PRINT "You dont have that!":RETURN
1930 IF S(Y,0)<>-1BEEP 1:PAUSE "You dont have that!":RETURN
1940 S(Y,0)=L:RETURN
2000 "I"PRINT "You are carrying...":G=2:FOR Y=0TO S:IF S(Y,0)=-1PRINT S$(Y)
2010 NEXT Y:RETURN
3000 "V"G=2:IF L<>6070PRINT "Nothing Happens":RETURN
3010 IF T>9.04PRINT "You are too late!":RETURN
3020 PRINT "The lid flys":PRINT "off the coffin!":PRINT "Dracula appears!
3030 IF S(5,0)<>-1PRINT "He unleashes all":PRINT "his might on you":GOSUB "%Q
3040 PRINT "He cringes away":PRINT "from the GOLD CROSS
3050 IF S(3,0)<>-1PRINT "The wooden STAKE":PRINT "would kill him!":RETURN
3060 PRINT "Want to stab":INPUT "him with your STAKE? ";Y$:GOSUB "%1ST
3070 IF Y$<>"Y"RETURN
3080 PRINT "Dracula vanishes forever!
3090 S(3,0)=0:G$="1":RETURN
3100 "F"IF L<>6200PRINT "Nothing Happens":G=2:RETURN
3110 G=1:L=6210:T=T+.05:RETURN
4000 DATA 10,"CAT FOOD",6020,1,"JEWELS",5070,2,"EMPTY JUG",6010,1
4010 DATA "STAKE",6050,1,"KEYS",5020,1,"GOLD CROSS",6030,3
4020 DATA "SNAKE KIT",6110,1,"FULL JUG",0,0,"CRYSTAL SHARD",0,3
4030 DATA "GOLD COINS",6140,3
4100 DATA 5,"CAT","DRACULA","WITCH","SNAKE","CLOCK
4200 "DRACULA"IF T<9.05OR G$="1"RETURN
4210 IF T=9.05BEEP 2:PRINT "Dracula is on the prowl!!":RETURN
4220 IF RND 5>1RETURN
4230 IF S(5,0)=-1RETURN
4240 PRINT "Dracula appears and":PRINT "bites your neck":P=P-100:VC=VC+1
4250 IF VC=3PRINT "You become undead!!":GOTO "%Q
4260 PRINT "You can survive":PRINT 2-VC;" more bite!":RETURN
4300 "WITCH"IF T<10.20RETURN
4305 IF T=10.20BEEP 2:PRINT "You hear a witches cackle!
4310 IF S(1,0)=0AND S(5,0)=0AND S(9,0)=0RETURN
4320 IF RND 4>1RETURN
4330 PRINT "A Witch appears":PRINT "demanding GOLD and JEWELS
4340 IF S(5,0)=-1LET S(5,0)=0:PRINT "She takes your GOLD CROSS!
4350 IF S(1,0)=-1LET S(1,0)=0:PRINT "She takes your JEWELS!
4360 IF S(9,0)=-1LET S(9,0)=0:PRINT "She takes your GOLD COINS!
4370 IF S(1,0)=0AND S(5,0)=0AND S(9,0)=0PRINT "The witch vanishes forever":RETURN
4380 PRINT "She looks you over":PRINT "and says Not Enough!!":PRINT "You must find me more!
4390 P=P-100:RETURN
4400 "CAT"IF L<>5060RETURN
4410 IF SL>=TPRINT "There is a ":PRINT "sleeping cat here":RETURN
4420 IF SL>0BEEP 2:PRINT "The cat woke up!!":SL=0
4430 PRINT "There is a":PRINT "Starving Cat here
4440 IF S(0,0)<>-1PRINT "He attacks!
4450 IF S(0,0)<>-1LET P=P-100:GOTO "%Q
4460 PRINT "Want to give":INPUT "the cat your CAT FOOD? ";Y$:GOSUB "%1ST
4465 IF Y$<>"Y"PRINT "The cat attacks":LET P=P-100:GOTO "%Q
4470 PRINT "The cat eats the CAT FOOD":PRINT "and falls asleep!
4480 S(0,0)=0:SL=T+.5+(RND 25)/100:IF SL-INT SL>.6LET SL=SL+.4
4490 RETURN
4500 "SNAKE"IF S(6,0)=-1IF U>0LET U=0:PRINT "You found the":PRINT "SNAKE KIT in time
4510 IF U<>0IF T>UPRINT "You did not find the cure":GOTO "%Q
4520 RETURN
4600 "CLOCK"IF T=INT TBEEP 1:PRINT "A clock strikes";T;" Oclock.
4610 IF T=12PRINT "IT IS MIDNIGHT!":PRINT "THE WORLD IS DESTROYED!":GOTO "%Q
4620 IF T=11.15PRINT "Better Hurry
4630 IF T=11.30PRINT "Quick, Hurry
4640 IF T=11.45PRINT "Time is running out!
4650 RETURN
5000 DATA 0,"Starting Place",0,0,0,5010,"Haunted House",0,0
5010 DATA 0,"Porch",0,5020,"Kitchen",5000,"Door to outside",0,0,0
5020 DATA 0,"Kitchen",5010,"Porch",5060,"Short Hall",0,5030,"Dining Room",0,0
5030 DATA 0,"Dining Room",0,5040,"Large Room",5020,"Kitchen",0,0,0
5040 DATA 0,"Large Room",5030,"Dining Room",5070,"Sliding Doors
5041 DATA 5050,"Small Room",5080,"Hallway",0,0
5050 DATA 0,"Small Room",5060,"Short Hall",0,0,5040,"Large Room",0,0
5060 DATA 0,"Short Hall",5020,"Kitchen",5050,"Small Room",0,0,6040
5061 DATA "Ascending Steps",0
5070 DATA 0,"Top of Steps",5040,"Large Room",0,0,0,0,6150,"Steps
5080 DATA 0,"T-Shaped Hall",5090,"Hall",6000,"Hall",5040,"Large Room",0,0,0,0
5090 DATA 0,"North Hall",6010,"Bathroom",5080,"Hall",0,6020,"Door",0,0
6000 DATA 0,"South Hall",5080,"Hall",0,0,6030,"Noisy Room",0,0
6010 DATA 0,"Main Bathroom",0,5090,"Hall",0,0,0,0
6020 DATA 6022,"Master Bedroom",0,0,5090,"Open Door",0,0,0
6022 PRINT "The door is locked!":IF S(4,0)<>-1LET G=2:L=5090:RETURN
6023 PRINT "Your KEYS unlock it":RETURN
6030 DATA 6035,"Music Room",0,0,6000,"Hall",0,0,0
6035 RANDOM :CLS :WAIT 0:FOR Y=1TO 50:GCURSOR RND 140:GPRINT 48;120;120;63;1;6:NEXT Y:GOSUB "%MU
6036 WAIT 100:CLS :RETURN
6040 DATA 0,"Top of Steps",6050,"Hallway",6080,"Hallway",0,0,0
6041 DATA 5060,"Decending Steps
6050 DATA 0,"North Hall",0,6040,"Hall",6060,"Door",6100,"Door",0,0
6060 DATA 6065
6065 PRINT "You see many":PRINT "piles of clothes.":PRINT "Suddenly,":PRINT "Something enters
6066 PRINT "You hide in":PRINT "a large laundry pile.":PRINT "Your pile is
6067 PRINT "forced into a":PRINT "small chute!":PRINT "You fall then...thud":G=1:L=6170:RETURN
6070 DATA 6071,"Draculas room",0,0,0,6080,"Open door",0,0
6071 IF T>9.04OR G$="1"PRINT "You see an empty coffin!":RETURN
6072 PRINT "You see a closed coffin":RETURN
6080 DATA 0,"South hall",6040,"Hallway",0,6070,"Doorway",6090,"Doorway",0,0
6090 DATA 0,"Messy room",6100,"Mess",6090,"Mess",6090,"Mess",6090,"Mess",0,0
6100 DATA 6104,"Bathroom",0,0,6050,"One Way Door",0,0,0
6104 IF H=6050PRINT "The door is locked!":G=2:L=6050:RETURN
6105 PRINT "You see water":PRINT "Running from a tap
6106 IF S(2,0)<>-1PRINT "You need a EMPTY JUG":RETURN
6107 INPUT "Want to fill your JUG? ";Y$:GOSUB "%1ST
6108 IF Y$="Y"LET S(7,0)=-1:S(2,0)=0
6109 RETURN
6110 DATA 0,"Bathroom",0,6120,"Door",0,0,0,0
6120 DATA 0,"East Passage",6110,"Door",6130,"Eerie Clicking",0,6180,"Winding Tunnel
6121 DATA 5040,"1 Way Steps",0
6130 DATA 6131,"Toy Train Room",6120,"Dark Passage",0,0,6190,"Doorway",0,0
6131 WAIT 0:FOR Y=130TO 0STEP -1:BEEP 1,255,5:GCURSOR Y
6132 GPRINT 0;16;59;127;127;59;60;124;120;56;63;115;115;63;33;0,
6133 PRINT "Do you want to trade":NEXT Y:WAIT 100
6134 INPUT "Everything for a secret? ";Y$:GOSUB "%1ST":IF Y$<>"Y"RETURN
6135 FOR Y=0TO S:IF S(Y,0)=-1LET S(Y,0)=0:PRINT "You were had!!"
6136 NEXT Y:RETURN
6140 DATA 6145,"Snake Pit",0,0,0,6150,"Doorway",0,0
6145 PRINT "The room is":PRINT "full of snakes!"
6146 IF S(6,0)=-1PRINT "Your SNAKE KIT saved you!":RETURN
6147 PRINT "One bites you!":PRINT "You panic and run!":PRINT ",noticing a glint":PRINT "of GOLD!
6148 PRINT "Find the SNAKE KIT":PRINT "within 40 MINUTES":U=T+.4:IF U-INT U>=.6LET U=U+.4
6149 G=1:L=H:P=P-100:RETURN
6150 DATA 0,"Rec Room",6160,"Orange Glow",0,6140,"Door",0,5070,"Steps",0
6160 DATA 6161,"Fireplace Room",0,6150,"Rec Room",6180,"Dark Passage",0,0,0
6161 PRINT "You are before a fireplace":IF S(8,0)<>0RETURN
6162 IF S(7,0)<>-1PRINT "If you had WATER":PRINT "You could put out":PRINT "the fire":RETURN
6163 PRINT "Want to pour":INPUT "the WATER on the fire? ";Y$:GOSUB "%1ST":IF Y$<>"Y"RETURN
6164 PRINT "The room is full of steam.":PRINT "A wise old wizard":PRINT "silently appears.
6165 PRINT "He leaves a CRYSTAL SHARD":PRINT "then he disappears!
6166 S(8,0)=6160:S(7,0)=0:S(2,0)=-1:RETURN
6170 DATA 0,"Laundry Room",6200,"Small Door",6180,"Dark Doorway",0,0,0,0
6180 DATA 0,"Winding Passage",6170,"Bright Colors",6190,"Doorway
6181 DATA 6120,"Dark Passage",6160,"Door",0,0
6190 DATA 6191,"Toy Room",6180,"Doorway",0,6130,"Eerie Clicks",0,0,0
6191 IF GH=1RETURN
6192 PRINT "A ghost appears and":PRINT "asks you to trade all":PRINT "your JEWELS
6193 PRINT "for a secret":INPUT "Do you trade? ";Y$:GOSUB "%1ST":IF Y$<>"Y"PRINT "Your loss!":RETURN
6194 IF S(1,0)<>-1PRINT "You cannot trick me!":PRINT "ZAP!!":G=1:L=5060:RETURN
6195 S(1,0)=0:PRINT "The ghost then":PRINT "gives you this":PRINT "secret message
6196 WAIT :PRINT "(Press ENTER to continue)
6197 PRINT "niffoC nepO oT":PRINT "KCUS SERIPMAV yaS":WAIT 100:RETURN
6200 DATA 6201,"Small Closet",0,6170,"Small Door",0,0,0,0
6201 PRINT "There is a faint":PRINT "inscription on the wall":PRINT "It says...":WAIT 200
6202 PRINT "Speak FRIEND and ENTER!":WAIT 100:RETURN
6210 DATA 6211,"Guard Room",6220,"Curtain",6200,"Doorway",0,0,0,0
6211 PRINT "A guard is sleeping here
6212 X=0:FOR Y=0TO S:IF S(Y,0)=-1LET X=X+1
6213 NEXT Y:IF X<3RETURN
6214 P=P-100:BEEP 2:PRINT "All your stuff makes noise":PRINT "The guard awakens!
6215 IF RND 2=1PRINT "The angry guard attacks!":GOTO "%Q
6216 PRINT "The guard chases you":PRINT "out of the room":G=1:L=6200:P=P-100:RETURN
6220 DATA 6221,"Crystal Room",0,6210,"Doorway",0,0,0,0
6221 PRINT "Behind the curtain":PRINT "is a locked door
6222 IF S(4,0)<>-1PRINT "You need your KEYS":L=6210:G=2:RETURN
6223 PRINT "The KEYS unlock the door":PRINT "You enter a bright room
6224 PRINT "There is a CRACKED CRYSTAL":PRINT "in the center of the room
6225 IF S(8,0)<>-1PRINT "You need a piece":PRINT "of this CRYSTAL":RETURN
6226 PRINT "Do you want to fit":PRINT "Your CRYSTAL SHARD":INPUT "In the crack? ";Y$
6227 GOSUB "%1ST":IF Y$<>"Y"RETURN
6228 PRINT "Your Mission is over":PRINT "Congratulations":P=P+400:GOSUB "P":N=0
6229 GOTO 10