Exclamation[HELP]Hangman

Posts 1–15 of 15 · Page 1 of 1
[HELP]Hangman
Hey guys I started a game in VB2008 hangman I have all of the GUI finished and need a little but of help on how to code this game, my mind is just puzzled I don't know where to start: Here is a picture of the game Design

I will be on here on my TeamViewer6 conect to me if you can help!
ID: 327 408 991
PASSWORD: 8272

BTW: I am also Live on Windows Live
User : veerank12@LiVee.com
Split each word. When the user presses a key, it should check if the correct word contains that key. If so, it should insert the character on all red blocks where that character resides. If not, then it should just cut down the character on every single mistake. That's how it works.

If you need help with coding, start coding and ask for help here.
Well the problem is I don't know how the code will look like
lol You did all guide but u dont know how to code it ? /troll

Try on the button search : "Hangman" I think u will find it.
Alright thanks! I like your tutorials :P

Actually I searched but no one has any of the Source codes Just 2 Games came up
The code just seems so confusing to me
Nvm XD found one
Nvm code was wrong
Quote Originally Posted by kunal1212 View Post
Alright thanks! I like your tutorials :P

Actually I searched but no one has any of the Source codes Just 2 Games came up
The code just seems so confusing to me
Nvm XD found one
If your problem gets resolved, please make sure to mention it here. Thanks!
Still need help with the code... TV if you can
Quote Originally Posted by kunal1212 View Post
Still need help with the code... TV if you can
Before I post any code, have you actually written any yet? And also, are all the red boxes TextBoxes?
Quote Originally Posted by Jason View Post


Before I post any code, have you actually written any yet? And also, are all the red boxes TextBoxes?
Yes they are, and no ATM i have no code
Quote Originally Posted by kunal1212 View Post
Yes they are, and no ATM i have no code
Dude, show us some effort from your side !
Lol guys I code alot of things from OS and to Others, If you TV me ill show you what I coded. But this thing JUST STUMPED me on the code. I don't even know what to do or where to start!
Quote Originally Posted by kunal1212 View Post
Lol guys I code alot of things from OS and to Others, If you TV me ill show you what I coded. But this thing JUST STUMPED me on the code. I don't even know what to do or where to start!
Code:
Dim NextWord = "Programming"

If UserPressed="m" Then

For i as integer=1 to NextWord.length
If mid(NextWord,i,1)="m" Then
Me.controls("Textbox" & i).text = "m"
LevelUp+=1
End If

End If
Something like that !
Quote Originally Posted by Hassan View Post

Code:
Dim NextWord = "Programming"

If UserPressed="m" Then

For i as integer=1 to NextWord.length
If mid(NextWord,i,1)="m" Then
Me.controls("Textbox" & i).text = "m"
LevelUp+=1
End If

End If
Something like that !
Lol looks like it will take too much time, Alright i think ill Forfiet on this one xD
Meh, 4:06am and I haven't been to sleep yet, and I'm pretty sure I'm still rather intoxicated. Nevertheless I'll do what I can.

Before we start change the "hint" textboxes Name property to something containing "hint", leave the rest as default

Firstly, create an array of your textboxes

Code:
Dim TextBoxes As TextBox() = Me.Controls.OfType(Of TextBox).Where(Function(t As TextBox) Not t.Name.Contains("hint")).Reverse.ToArray


Then define your "word" (you can change this however you want, I just declared word because I'm doing it from scratch)

Code:
Dim word As String = "test"


now that we have our word, we want to assign each letter to a textbox.

Code:
For i As Integer = 0 To word.Length
    TextBoxes(i).Tag = word(i).ToString
Next


The tag is held "behind the scenes" so that's that handled. Next we need to deal with the users input letter. Again I've simply made a variable to hold the input, so you'll need to change it appropriately.

Code:
Dim input As String = "W"
Dim successCount As Integer = 0
For each tBox As TextBox In TextBoxes
    If tBox.Tag.ToLower = input.ToLower Then
        tBox.Text = tBox.Tag
        successCount += 1
    End If
Next tBox

If successCount = 0 Then DoNextHangmanAnimation


And that should be about it. I didn't test any of this, or even put it in the VB IDE, so yeah, hope it works. I'm now going to bed as it's 4:30am. Good night.
Quote Originally Posted by Jason View Post
Meh, 4:06am and I haven't been to sleep yet, and I'm pretty sure I'm still rather intoxicated. Nevertheless I'll do what I can.

Before we start change the "hint" textboxes Name property to something containing "hint", leave the rest as default

Firstly, create an array of your textboxes

Code:
Dim TextBoxes As TextBox() = Me.Controls.OfType(Of TextBox).Where(Function(t As TextBox) Not t.Name.Contains("hint")).Reverse.ToArray


Then define your "word" (you can change this however you want, I just declared word because I'm doing it from scratch)

Code:
Dim word As String = "test"


now that we have our word, we want to assign each letter to a textbox.

Code:
For i As Integer = 0 To word.Length
    TextBoxes(i).Tag = word(i).ToString
Next


The tag is held "behind the scenes" so that's that handled. Next we need to deal with the users input letter. Again I've simply made a variable to hold the input, so you'll need to change it appropriately.

Code:
Dim input As String = "W"
Dim successCount As Integer = 0
For each tBox As TextBox In TextBoxes
    If tBox.Tag.ToLower = input.ToLower Then
        tBox.Text = tBox.Tag
        successCount += 1
    End If
Next tBox

If successCount = 0 Then DoNextHangmanAnimation


And that should be about it. I didn't test any of this, or even put it in the VB IDE, so yeah, hope it works. I'm now going to bed as it's 4:30am. Good night.
Jason you are such a fast coder. Very good job. I don't understand why OP wasn't able to code such basic stuff. Anyways kewl.

Edit: 2500th Post. Will get underlined name and 175*175 size avatar.
Posts 1–15 of 15 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us