Computer Science Canada help! hangman game |
Author: | chocoyummi [ Wed May 25, 2011 10:33 pm ] |
Post subject: | help! hangman game |
Hello i am a very new programmer and i dont really know much about turing. and i have to make a game thats kind of like hangman. i am doing okay, but i am having a lttle issue. realise when you play hangman, the program outputs heads, arms and legs as chances? i don't know how to do that. can someone please help me?? thanks!! ![]() just so you know, i wanted to put the picture "imagesCAP41ML3.bmp" instead of the hangman person. this is my program and thats all i have done ![]() ______________________________________________________________________________________________________________________________________ setscreen ("graphics:max;max") var letter : string var counter, counter1, countera, counter2, counterb, counter3 : int := 0 var font : int var answer : string var pica, wrong :int var spritea :int font := Font.New ("Kristen ITC:50:bold") Font.Draw ("The Traveling Guess!", 170,500,font, 47) delay(3000) cls pica := Pic.FileNew ("cartoon_airplane.bmp") spritea := Sprite.New (pica) Font.Draw ("Here We Go!~", 170, 500, font, 68) Sprite.Show (spritea) for i : 1 .. maxx + 200 Sprite.SetPosition(spritea, i, 300, true) delay (5) end for delay(1000) cls loop put "enter a letter:" get letter if letter = "p" then Font.Draw ("P", 10, 50, font, 100) counter := counter + 1 elsif letter = "a" then Font.Draw ("A", 70, 50, font, 100) counter := counter + 1 elsif letter = "r" then Font.Draw ("R", 130, 50, font, 100) counter := counter + 1 elsif letter = "i" then Font.Draw ("I", 190, 50, font, 100) counter := counter + 1 elsif letter = "s" then Font.Draw ("S", 230, 50, font, 100) counter := counter + 1 else loop put "Your guess is wrong!" wrong := Pic.FileNew ("imagesCAP41ML3.bmp") wrong := Pic.Scale (wrong, 150,150) Pic.Draw (wrong,500,600, picMerge) end loop counter1 := counter1 + 1 end if if counter = 5 then put "You got it!" exit elsif counter1 = 10 then put "Your chances are up!" exit end if end loop delay (2000) cls put "Want to try again?" get answer delay (2000) cls loop if answer = "no" then exit elsif answer = "yes" then put "enter a letter" get letter end if if letter = "b" then Font.Draw ("B", 10, 50, font, 100) countera := countera + 1 elsif letter = "r" then Font.Draw ("R", 70, 50, font, 100) countera := countera + 1 elsif letter = "a" then Font.Draw ("A", 130, 50, font, 100) countera := countera + 1 elsif letter = "z" then Font.Draw ("Z", 190, 50, font, 100) countera := countera + 1 elsif letter = "i" then Font.Draw ("I", 250, 50, font, 100) countera := countera + 1 elsif letter = "l" then Font.Draw ("L", 290, 50, font, 100) countera := countera + 1 else put "Your guess is wrong!" counter2 := counter2 + 1 end if if countera = 6 then put "Your got it!" exit elsif counter2 = 10 then put "Your chances are up!" exit end if end loop delay (2000) cls put "Want to try again?" get answer delay (2000) cls loop if answer = "no" then exit elsif answer = "yes" then end if put "enter a letter" get letter if letter = "m" then Font.Draw ("M", 10, 50, font, 100) counterb := counterb +1 elsif letter = "e" then Font.Draw ("E", 80, 50, font, 100) counterb := counterb +1 elsif letter = "x" then Font.Draw ("X", 130, 50, font, 100) counterb := counterb +1 elsif letter = "i" then Font.Draw ("I", 190, 50, font, 100) counterb := counterb +1 elsif letter = "c" then Font.Draw ("C", 230, 50, font, 100) counterb := counterb +1 elsif letter = "o" then Font.Draw ("O", 290, 50, font, 100) counterb := counterb +1 else put "Your guess is wrong!" counter3 := counter3 + 1 end if if counterb = 6 then put "You got it!" exit elsif counter3 = 10 then put "Your chances are up!" exit end if end loop |
Author: | Tony [ Wed May 25, 2011 10:39 pm ] |
Post subject: | Re: help! hangman game |
chocoyummi @ Wed May 25, 2011 10:33 pm wrote: realise when you play hangman, the program outputs heads, arms and legs as chances? i don't know how to do that. You could either load different pre-made image files on top of each other with Pic.Draw or do your own pixel graphics as needed with things like Draw.Line and Draw.Oval |
Author: | chocoyummi [ Wed May 25, 2011 11:02 pm ] |
Post subject: | RE:help! hangman game |
but i don't know how to put the images side by side. i want an image to appear right beside each other once the player puts a wrong guess. |
Author: | Tony [ Wed May 25, 2011 11:22 pm ] |
Post subject: | RE:help! hangman game |
Well, how have you tried to display the images so far? |