Turing: Hangman
Posted: Tue Jan 22, 2008 8:06 pm
So I'm stuck with my hangman game right now.
Code: Select all
import shape in "shape.tu"
var found : boolean := false
var choice, letter : string
var font1 : int
font1 := Font.New ("Comic Sans MS:20")
colorback (53)
cls
put "Do you want to Play?"
put "Yes"
put "No"
get choice
if choice = "Yes" or choice = "YES" or choice = "yes" then
cls
put "Choose a Category"
put "1. Animals"
put "2. Music"
put "3. Solar System"
put "4. Vegetables"
put "5. Transportation"
put "Enter 1, 2, 3, 4 or 5, the press 'Enter'"
get choice
cls
case choice of
label "1" :
put "Animals"
Draw.Line (500, 100, 500, 280, black)
Draw.Line (400, 280, 500, 280, black)
Draw.Line (400, 260, 400, 280, black)
Draw.Line (20, 100, 50, 100, black)
Draw.Line (60, 100, 90, 100, black)
Draw.Line (100, 100, 130, 100, black)
Draw.Line (140, 100, 170, 100, black)
Draw.Line (180, 100, 210, 100, black)
Draw.Line (220, 100, 250, 100, black)
loop
put "Guess a letter"
get letter
for i : 1 .. 20
if letter = "b" or letter = "B" then
Font.Draw (letter, 20, 100, font1, 12)
elsif letter = "e" or letter = "E" then
Font.Draw (letter, 60, 100, font1, 12)
Font.Draw (letter, 180, 100, font1, 12)
elsif letter = "a" or letter = "A" then
Font.Draw (letter, 100, 100, font1, 12)
elsif letter = "v" or letter = "V" then
Font.Draw (letter, 140, 100, font1, 12)
elsif letter = "r" or letter = "R" then
Font.Draw (letter, 220, 100, font1, 12)
end if
end for
if found = true then
else
cls
end if
end loop
end case
end if
[code]
This is what I have, and I am completely stuck. Anyone be able to help me figure out how to make this work?
My problems are:
I can't get the pieces of the hangman to show up when the letter is wrong. I can't even get the letter to show up when it's right! I just need to get it working properly. So can anyone help me? Or does anyone have a hangman game that's done that I could use for a referance? I am desperate for help. Please anyone?
Thanks :).
[color=#888888][size=85]Archived topic from Iceteks, old topic ID:4984, old post ID:38653[/size][/color]