TGC Codebase Backup



Guess that number by Slayer93

31st Jul 2004 7:54
Summary

Guess a number from 0-10



Description

Guess a number from 0-10 get it right you get a point get 5 points you win.But have 15 tries.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    ````````Guess that number``````````````
`load music
load music "Mind Trick.mid",1
play music 1
loop music 1

`sync
sync on
sync rate 40

`title screen
set text size 30
center text 300,0,"Let's play guess that number !!!!"
ink RGB(0,128,255),0
center text 300+1,0+1,"Let's play guess that number !!!! "
center text 300-1,0-1,"Let's play guess that number !!!! "
center text 300+1,0-1,"Let's play guess that number !!!! "
center text 300-1,0+1,"Let's play guess that number !!!! "
ink RGB(255,255,255),255
set text size 28
center text 300,0,"Let's play guess that number !!!!"
text 100,50,"If you get 5 points you win"
text 150,100,"but only have 15 tries"
set text size 10 
text 200,350,"press any key to continue"
suspend for key

`the game varibles
tries=15
score=0
set text size 28

`game loop
do
cls (0)
print "score: ";score
set cursor 500,0
print "tries left: ";tries
dec tries
if tries=-1 then text 250,250,"You lose"
if score=5 then text 250,250,"You won"
random=rnd(10)
text 100,0,"guess a number from 0 to 10"
set cursor 250,250
input "";number
if random=number then inc score
if random=number
text 100,200,"You got the number"
else
text 100,200,"That is not the number"
endif
sleep 2000
sync
loop