HangMan
Author |
Message |
CPT_HAMINATOR
|
Posted: Wed Nov 08, 2006 8:41 am Post subject: HangMan |
|
|
I am making a hangman game for a grade 11 computer course its not a final or anything, but we have to have it done in a couple days. It has to have a menu for words you can pick, they have to be sports, countries, animals,random, 2 player game, add a word, delete a word, and exit. If any one could help me it would be greatly appriciated |
|
|
|
|
|
Sponsor Sponsor
|
|
|
rdrake
|
Posted: Wed Nov 08, 2006 8:52 am Post subject: (No subject) |
|
|
So... do you have a specific question? |
|
|
|
|
|
DemonZ
|
Posted: Wed Nov 08, 2006 3:30 pm Post subject: (No subject) |
|
|
now are you just expecting us to write you a game from our time and effort and give to you and say " Heres your game"! Sorry it doesnt work like that, first you make your program, and if you run into trouble with it post your code and problem and will try to fix it, other than that, we will refuse to do your assignment for you. |
|
|
|
|
|
Piro24
|
Posted: Wed Nov 08, 2006 4:26 pm Post subject: (No subject) |
|
|
If you want to make a menu, use a case. The labels on the case should be the procudure's of the menu... |
|
|
|
|
|
CPT_HAMINATOR
|
Posted: Wed Nov 08, 2006 9:20 pm Post subject: (No subject) |
|
|
im not asking any one to make me a program im just asking for help. we need to save the words first and use like 5 procedures to call up the words and to make the hang man. i was just wondering if any one could help me out. because all of the hangman games i have looked at all have the words in the actual game. we have to load ours. but if no one wants to help it all good |
|
|
|
|
|
DemonZ
|
Posted: Wed Nov 08, 2006 9:42 pm Post subject: (No subject) |
|
|
just give us a specific question to help you with, your question, if it is one is to general, be more specific. |
|
|
|
|
|
jrblast
|
Posted: Wed Nov 08, 2006 10:01 pm Post subject: (No subject) |
|
|
I think hes not sure how to have it choose from different categories. if this is true you can do this.
Have the user select which categories (s)he wants.
There will be a data file for each category, the program will load the appropriate data file based on the chosen categories...
If thats not your problem, please be more specific. |
|
|
|
|
|
Dan
|
Posted: Wed Nov 08, 2006 10:03 pm Post subject: (No subject) |
|
|
The basicks of the game are quite simple.
1. randomly deside apone a string to be the word.
2. get 1 char input from the user.
3. sreach the string for that letter.
4. a. if it is in the string display that letter in the right place.
4. b. if it is not in that string display a pice of the man.
5. go back to 2 and keep going intill the man is drawn or the word is found.
___________
To find a random word to use, make an array of of posible words (strings) and then use the random features of turing to randomly pick an index for that array. That is the word to be used.
To see if a char is in the word you could use a simple sreach method of looping threw each char of the picked sring and comparing that char asgisted the user inputed one. This can be done in a procedure that returns a boolean if you like.
Next if it is a char in the word you have to draw the letter, this should be done with the font.draw comand and needs a bit of math to place it right. To do this math you need to know the length of the randomly picked string and then divied it by the size of the letter in your choision font. Now the placement for the letter is the above caluation times the index of char in the string. Note that a word could have more then one of the same char, this drawing could be done in the loop to check for the letter once the letter is found.
Now if the letter is not found you draw part of the man. This can be easly done using turings draw comands or you could load pics for it. You will need to keep track of what part you are drawing.
Fianly stop the game if the last part is drawn or all the letters are found.
P.S. another method for drawing the string as it is being found is to simpley make a string that has _s for each missing letter and add the found letters to the sting as they are found and then draw this string. This is alot easer then drawing the letters induviualy. |
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
|
Sponsor Sponsor
|
|
|
|
|