TGC Codebase Backup



Text based adventure for total newbies to programming by Big Man

27th Jul 2005 10:22
Summary

This is a text based adventure for people who have never ever code in their life. (I got bored one day and decided to write this it only took me ten minutes)



Description

Because this is such a basic program it may not seem that clear so here is a quick help for you - The list of answers is the answers for the whole thing each one will be an answer to one of the questions. You have to type them in excactly as you see it or it won't work.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    set text size 30
center text 320,20,"Text adventure - Go shopping"
set text size 20
center text 320,70,"choose answer from list and write it in exactly as you see it"
center text 320,200,"Press enter to continue"
suspend for key
1=returnkey()
if returnkey()=1 then cls

rem these few lines of code open the story with some text
rem the "wait" command holds the screen for the number of milliseconds(5000)
print "It is a fine saturday afternoon, the sun is hot and there is a nice breeze in the air."
wait 5000
cls
Print "You decide you need a drink of water but because of a recent drought your taps are empty"
wait 5000
cls

rem the main loop notice the repeat of the list of answers this is so you can
rem see them when you want to
rem I have used a variable called rightanswer to decide whether or not
rem the right answer is given
do
center text 320,80,"here is a list of answers"
center text 320,130,"buy some food"
center text 320,160,"buy some water"
center text 320,190,"no"
center text 320,220,"offer to work at shop"
center text 320,250,"yes"
input "What should you do: ",a$
if a$="buy some water" then goto buy : rightanswer=1
if rightanswer=0 then goto lose

buy:
cls
center text 320,80,"here is a list of answers"
center text 320,130,"buy some food"
center text 320,160,"buy some water"
center text 320,190,"no"
center text 320,220,"offer to work at shop"
center text 320,250,"yes"
print "Well done"
wait 2000
cls
print "You arrive at the store and buy a bottle of water to quench your thirst"
wait 5000
cls
print "Your tummy growls at you for food"
wait 3000
cls
center text 320,80,"here is a list of answers"
center text 320,130,"buy some food"
center text 320,160,"buy some water"
center text 320,190,"no"
center text 320,220,"offer to work at shop"
center text 320,250,"yes"
input "What do you do: ",b$
if b$="buy some food" then goto food : rightanswer=1
if rightanswer=0 then goto lose

food:
cls
center text 320,80,"here is a list of answers"
center text 320,130,"buy some food"
center text 320,160,"buy some water"
center text 320,190,"no"
center text 320,220,"offer to work at shop"
center text 320,250,"yes"
print "well done"
wait 2000
cls
print "you reach into your pocket and it is empty, with no money you can't buy that ginsters pasty"
wait 5000
cls
center text 320,80,"here is a list of answers"
center text 320,130,"buy some food"
center text 320,160,"buy some water"
center text 320,190,"no"
center text 320,220,"offer to work at shop"
center text 320,250,"yes"
input "What now: ",c$
if c$="offer to work at shop" then goto work : rightanswer=1
if rightanswer=0 then goto lose
end

work:
cls
center text 320,80,"here is a list of answers"
center text 320,130,"buy some food"
center text 320,160,"buy some water"
center text 320,190,"no"
center text 320,220,"offer to work at shop"
center text 320,250,"yes"
print "Right again"
wait 2000
cls 
print "You work for two hours and earn your self £7.50 and you are more hungry now than ever"
wait 5000
cls
print "You then notice that ginsters pasties are on special offer two for £5.00"
wait 5000
cls
center text 320,80,"here is a list of answers"
center text 320,130,"buy some food"
center text 320,160,"buy some water"
center text 320,190,"no"
center text 320,220,"offer to work at shop"
center text 320,250,"yes"
input "do you want to buy the pasties: ",d$
if d$="yes" then goto yes : rightanswer=1
if rightanswer=0 then goto no

yes:
cls
center text 320,80,"here is a list of answers"
center text 320,130,"buy some food"
center text 320,160,"buy some water"
center text 320,190,"no"
center text 320,220,"offer to work at shop"
center text 320,250,"yes"
print "You buy the two pasties for £5.00 and when you are out of the shop you read the label"
wait 5000
cls
print "and notice that you are allergic to three of the main ingredients"
wait 4000
goto lose

no:
cls
center text 320,80,"here is a list of answers"
center text 320,130,"buy some food"
center text 320,160,"buy some water"
center text 320,190,"no"
center text 320,220,"offer to work at shop"
center text 320,250,"yes"
Print "You decide against the pasties and opt for a bag of chips at £2.00 and an ice cream at £1.00"
wait 5000
cls
print "not bad for two hour work"
wait 2000
cls
print "You arrive back at home an go to bed and in the next few hours..."
wait 4000
goto lose

lose:
cls
print "You die"
end
sync
loop