You Suck!
hartnell 05 Jun 2007 12:09
You Suck! is my first original text game in a long time. You Suck! has it's own instructions. :)
TextMode(TEXT_BUFFERED)
Dim a, b, delay, answer$, now
Dim right, wrong, total
Gosub InitGame
Gosub Instructions
Gosub DisplayWarning
Do
Gosub GenerateNumbers
Cls
Printr "What is " ; a ; " + " ; b ; "?"
DrawText()
now = TickCount() + delay
ClearKeys()
Do
answer$ = Inkey$()
Loop Until answer$ <> "" Or TickCount() > now
If Val(answer$) = a + b Then
Printr "Congrats!"
right = right + 1
Else
Printr "Oh man! You got one wrong!"
DrawText()
Sleep(1000)
Printr "You SUCK!!!"
DrawText()
Sleep(1000)
wrong = 1
EndIF
total = total + 1
delay = delay - 100
DrawText()
Sleep(800)
Loop Until delay = 1000 Or wrong = 1
Printr
Printr "You got " ; right ; " out of " ; total "."
DrawText()
Sleep(2000)
If total < 10 Then
Printr
Printr "You didn't even make it to 10!"
DrawText()
Sleep(2000)
EndIf
Printr
Printr "Game Over"
DrawText()
End
InitGame:
delay = 2000
right = 0
total = 0
wrong = 0
Return
Instructions:
Printr "Would you like instructions?"
DrawText()
Do : answer$ = Inkey$() : Loop Until answer$ <> ""
If LCase$(answer$) = "n" Or LCase$(answer$) = "no" Then Return EndIf
Cls
Printr "You Suck! is a simple game to play."
Printr
Printr "You will be given 10 simple addition"
Printr "problems one by one. They are so easy"
Printr "you shouldn't miss a single one."
Printr
Printr "You will have a decreasing amount of"
Printr "time to answer each one. If you are"
Printr "not able to answer in time or give"
Printr "the wrong answer..."
Printr " then...."
Printr " YOU SUCK!"
Printr
DrawText()
Return
DisplayWarning:
Color(255,0,0)
Printr "---------------------------------"
Printr "Turn on the num-lock and put your"
Printr "fingers on the numpad."
Printr "---------------------------------"
Printr
Color(210,210,255)
Printr "Press any key to begin."
DrawText()
ClearKeys()
Do While Inkey$() = "" : Loop
Return
GenerateNumbers:
a = Rnd() % 9
b = Rnd() % 9
If a + b > 9 Then Goto GenerateNumbers EndIf
Return
—hartnell