943,824 Members | Top Members by Rank

Ad:
You are currently viewing page 3 of this multi-page discussion thread; Jump to the first page
Aug 23rd, 2008
0

Re: Simple Hangman Game

^^alright thanx
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Lil' Tripsturr is offline Offline
16 posts
since Aug 2008
Aug 26th, 2008
0

Re: Simple Hangman Game

have found a really interesting ,but simple hangman game on the net but i am really confused to how it actually works ,i would like to re-create it for myself but first i would need to understand it.it seems to use complicated code ,but there is much of it and the creator hasnt labeled all the pieces of code so it doesnt help.If u cud help me to disect the code then id be grateful .

The most confusing part of the code is how the creator actually got the letter and characters to appear like they do.Also would you be able to explain "CheckChar" ,"String$","UCase" , "Call" and "QuestionHandler"

http://www.sendspace.com/file/a4wye8

thanx
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Lil' Tripsturr is offline Offline
16 posts
since Aug 2008
Aug 26th, 2008
0

Re: Simple Hangman Game

Hi!
String$ is used to output a string by the specified length for the given character in the second parameter.

Ex:

text1.text = String$(10,"*")

will fill the textbox with ten *

Regards
Shaik Akthar
Reputation Points: 26
Solved Threads: 40
Posting Whiz
aktharshaik is offline Offline
316 posts
since Aug 2008
Aug 26th, 2008
1

Re: Simple Hangman Game

UCASE Converts the given string to uppercase.


Ex
Dim x as string
x = "America"
text1.text = UCase(x)

here text1 will display the word in variable x but in upper case "AMERICA"

Regards
Shaik Akthar
Reputation Points: 26
Solved Threads: 40
Posting Whiz
aktharshaik is offline Offline
316 posts
since Aug 2008
Aug 26th, 2008
0

Re: Simple Hangman Game

Call keyword is used to call any procedure by its name but its purely optional

like u can write

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Call txtGuess_Change

or just

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. txtGuess_Change

Regards
Shaik Akthar
Reputation Points: 26
Solved Threads: 40
Posting Whiz
aktharshaik is offline Offline
316 posts
since Aug 2008
Aug 26th, 2008
0

Re: Simple Hangman Game

^^ok so u dont need to use it ???thats good thanx.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Lil' Tripsturr is offline Offline
16 posts
since Aug 2008
Aug 27th, 2008
0

Re: Simple Hangman Game

can someone please explain "ChkChar"???I will rep.

ALSO

would someone please be able to tell me how to make code for the game so that it counts the number of correct guesses,for this game.I know that a label will need to be used etc.

http://www.sendspace.com/file/a4wye8

and for

Hangman.zip http://www.daniweb.com/forums/attach...1&d=1218656270
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Lil' Tripsturr is offline Offline
16 posts
since Aug 2008
Aug 28th, 2008
0

Re: Simple Hangman Game

still unsolved!!!check the above problem,there have been nearly 1000 views and no-1 can help me??I will rep if someone helps with this LAST problem!!!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Lil' Tripsturr is offline Offline
16 posts
since Aug 2008
Aug 28th, 2008
1

Re: Simple Hangman Game

'Posi ' variable is used to track as when to move to the next line to print the body or arms or legs of the hangman.

when 'Posi' is 2 (i.e) when 2nd wrong guess is made, the '|' character must go to next line. hence 'Posi' is checked and if it is 2 a new line (vbCrLf) is appended.

Similarly when 'Posi' is 3 again we have to move to the next line to start the hands.
and when 'Posi' is 6 we have to move to the next line to start the legs.

Finally when 'Posi' is 8 (i.e) the hangmans last leg is to be displayed, then will be the end of the guesses because man hanging is complete with the last leg.

This is the point where the user is failed to guess the correct answer.

CheckChar function is used to check if the character typed in the guess box is present in the string pertaining to the 'intQuestionNumber'th value in the array. if not the guess is wrong. hence clear the Guess TextBox and go for the next try. If all tries are over i.e. 'Posi' is reached 8 as said above the game is lost. if before the 'Posi' reaches 8 the string the Question label with '_' matches the 'intQuestionNumber'th value in the array, the game is won.

Also u can count the wins and losses also.

Take 2 global integer variables and make then equal to 0 during form load.
One for Win Count and one for Lost Count.
The sum of these two will be Played Count.

Check out the attachment i have modified.

Some other suggestions
================
1. Change the words now and then
or
2. increase the number of words
or
3. put the strings in a text file and read the values from them

No 3. is better because u need not compile ur project again and again whenever u change the words.



Regards
Shaik Akthar
Attached Files
File Type: zip hangmanNew.zip (7.0 KB, 49 views)
Reputation Points: 26
Solved Threads: 40
Posting Whiz
aktharshaik is offline Offline
316 posts
since Aug 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: inserting Serial No in Report
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Report Problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC