hey guys, i need help in my logic formulation. i'm creating a game like text twist. that when i press letter a, i need to determine which picturebox contains letter a and display it to different location. that also goes to the proceeding letter a's. for example, i have a jumbled letters "aamba". in my code, it only gets the first letter a and removes it form the screen, it's nowhere to be found. and it won't recognize that i still have other letter a's i'm pretty sure about the location that i set it to be placed.
here is my code: (it's kind of brute force i think)
I don't know if I just missed out some code since it's too long. Or my logic wasn't that good to perform what I want with my letters. If anyone can provide me a better logic or even a suggestion. I will be fully thankful! THANKS!
here is my code: (it's kind of brute force i think)
ElseIf e.KeyChar = Chr(97) Then counter1 = 0 If letterPicbox1.Tag Is "a" Then If counter1 = 0 Then If currentWordLen = 5 Then letterPicbox1.Location = New Point(145, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox1.Location = New Point(110, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox1.Location = New Point(80, 100) counter1 += 1 End If ElseIf counter1 = 1 Then If currentWordLen = 5 Then letterPicbox1.Location = New Point(225, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox1.Location = New Point(190, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox1.Location = New Point(160, 100) counter1 += 1 End If ElseIf counter1 = 2 Then If currentWordLen = 5 Then letterPicbox1.Location = New Point(305, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox1.Location = New Point(270, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox1.Location = New Point(240, 100) counter1 += 1 End If ElseIf counter1 = 3 Then If currentWordLen = 5 Then letterPicbox1.Location = New Point(385, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox1.Location = New Point(350, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox1.Location = New Point(320, 100) counter1 += 1 End If ElseIf counter1 = 4 Then If currentWordLen = 5 Then letterPicbox1.Location = New Point(465, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox1.Location = New Point(430, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox1.Location = New Point(400, 100) counter1 += 1 End If ElseIf counter1 = 5 Then If currentWordLen = 6 Then letterPicbox1.Location = New Point(510, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox1.Location = New Point(480, 100) counter1 += 1 End If ElseIf counter1 = 6 Then If currentWordLen = 7 Then letterPicbox1.Location = New Point(560, 100) counter1 += 1 End If End If ElseIf letterPicbox2.Tag Is "a" Then If counter1 = 0 Then If currentWordLen = 5 Then letterPicbox2.Location = New Point(145, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox2.Location = New Point(110, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox2.Location = New Point(80, 100) counter1 += 1 End If ElseIf counter1 = 1 Then If currentWordLen = 5 Then letterPicbox2.Location = New Point(225, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox2.Location = New Point(190, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox2.Location = New Point(160, 100) counter1 += 1 End If ElseIf counter1 = 2 Then If currentWordLen = 5 Then letterPicbox2.Location = New Point(305, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox2.Location = New Point(270, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox2.Location = New Point(240, 100) counter1 += 1 End If ElseIf counter1 = 3 Then If currentWordLen = 5 Then letterPicbox2.Location = New Point(385, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox2.Location = New Point(350, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox2.Location = New Point(320, 100) counter1 += 1 End If ElseIf counter1 = 4 Then If currentWordLen = 5 Then letterPicbox2.Location = New Point(465, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox2.Location = New Point(430, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox2.Location = New Point(400, 100) counter1 += 1 End If ElseIf counter1 = 5 Then If currentWordLen = 6 Then letterPicbox2.Location = New Point(510, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox2.Location = New Point(480, 100) counter1 += 1 End If ElseIf counter1 = 6 Then If currentWordLen = 7 Then letterPicbox2.Location = New Point(560, 100) counter1 += 1 End If End If ElseIf letterPicbox3.Tag Is "a" Then If counter1 = 0 Then If currentWordLen = 5 Then letterPicbox3.Location = New Point(145, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox3.Location = New Point(110, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox3.Location = New Point(80, 100) counter1 += 1 End If ElseIf counter1 = 1 Then If currentWordLen = 5 Then letterPicbox3.Location = New Point(225, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox3.Location = New Point(190, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox3.Location = New Point(160, 100) counter1 += 1 End If ElseIf counter1 = 2 Then If currentWordLen = 5 Then letterPicbox3.Location = New Point(305, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox3.Location = New Point(270, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox3.Location = New Point(240, 100) counter1 += 1 End If ElseIf counter1 = 3 Then If currentWordLen = 5 Then letterPicbox3.Location = New Point(385, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox3.Location = New Point(350, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox3.Location = New Point(320, 100) counter1 += 1 End If ElseIf counter1 = 4 Then If currentWordLen = 5 Then letterPicbox3.Location = New Point(465, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox3.Location = New Point(430, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox3.Location = New Point(400, 100) counter1 += 1 End If ElseIf counter1 = 5 Then If currentWordLen = 6 Then letterPicbox3.Location = New Point(510, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox3.Location = New Point(480, 100) counter1 += 1 End If ElseIf counter1 = 6 Then If currentWordLen = 7 Then letterPicbox3.Location = New Point(560, 100) counter1 += 1 End If End If ElseIf letterPicbox4.Tag Is "a" Then If counter1 = 0 Then If currentWordLen = 5 Then letterPicbox4.Location = New Point(145, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox4.Location = New Point(110, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox4.Location = New Point(80, 100) counter1 += 1 End If ElseIf counter1 = 1 Then If currentWordLen = 5 Then letterPicbox4.Location = New Point(225, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox4.Location = New Point(190, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox4.Location = New Point(160, 100) counter1 += 1 End If ElseIf counter1 = 2 Then If currentWordLen = 5 Then letterPicbox4.Location = New Point(305, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox4.Location = New Point(270, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox4.Location = New Point(240, 100) counter1 += 1 End If ElseIf counter1 = 3 Then If currentWordLen = 5 Then letterPicbox4.Location = New Point(385, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox4.Location = New Point(350, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox4.Location = New Point(320, 100) counter1 += 1 End If ElseIf counter1 = 4 Then If currentWordLen = 5 Then letterPicbox4.Location = New Point(465, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox4.Location = New Point(430, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox4.Location = New Point(400, 100) counter1 += 1 End If ElseIf counter1 = 5 Then If currentWordLen = 6 Then letterPicbox4.Location = New Point(510, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox4.Location = New Point(480, 100) counter1 += 1 End If ElseIf counter1 = 6 Then If currentWordLen = 7 Then letterPicbox4.Location = New Point(560, 100) counter1 += 1 End If End If ElseIf letterPicbox5.Tag Is "a" Then If counter1 = 0 Then If currentWordLen = 5 Then letterPicbox5.Location = New Point(145, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox5.Location = New Point(110, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox5.Location = New Point(80, 100) counter1 += 1 End If ElseIf counter1 = 1 Then If currentWordLen = 5 Then letterPicbox5.Location = New Point(225, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox5.Location = New Point(190, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox5.Location = New Point(160, 100) counter1 += 1 End If ElseIf counter1 = 2 Then If currentWordLen = 5 Then letterPicbox5.Location = New Point(305, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox5.Location = New Point(270, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox5.Location = New Point(240, 100) counter1 += 1 End If ElseIf counter1 = 3 Then If currentWordLen = 5 Then letterPicbox5.Location = New Point(385, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox5.Location = New Point(350, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox5.Location = New Point(320, 100) counter1 += 1 End If ElseIf counter1 = 4 Then If currentWordLen = 5 Then letterPicbox5.Location = New Point(465, 100) counter1 += 1 ElseIf currentWordLen = 6 Then letterPicbox5.Location = New Point(430, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox5.Location = New Point(400, 100) counter1 += 1 End If ElseIf counter1 = 5 Then If currentWordLen = 6 Then letterPicbox5.Location = New Point(510, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox5.Location = New Point(480, 100) counter1 += 1 End If ElseIf counter1 = 6 Then If currentWordLen = 7 Then letterPicbox5.Location = New Point(560, 100) counter1 += 1 End If End If ElseIf letterPicbox6.Tag Is "a" Then If counter1 = 0 Then If currentWordLen = 6 Then letterPicbox6.Location = New Point(110, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox6.Location = New Point(80, 100) counter1 += 1 End If ElseIf counter1 = 1 Then If currentWordLen = 6 Then letterPicbox6.Location = New Point(190, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox6.Location = New Point(160, 100) counter1 += 1 End If ElseIf counter1 = 2 Then If currentWordLen = 6 Then letterPicbox6.Location = New Point(270, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox6.Location = New Point(240, 100) counter1 += 1 End If ElseIf counter1 = 3 Then If currentWordLen = 6 Then letterPicbox6.Location = New Point(350, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox6.Location = New Point(320, 100) counter1 += 1 End If ElseIf counter1 = 4 Then If currentWordLen = 6 Then letterPicbox6.Location = New Point(430, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox6.Location = New Point(400, 100) counter1 += 1 End If ElseIf counter1 = 5 Then If currentWordLen = 6 Then letterPicbox6.Location = New Point(510, 100) counter1 += 1 ElseIf currentWordLen = 7 Then letterPicbox6.Location = New Point(480, 100) counter1 += 1 End If ElseIf counter1 = 6 Then If currentWordLen = 7 Then letterPicbox6.Location = New Point(560, 100) counter1 += 1 End If End If ElseIf letterPicbox7.Tag Is "a" Then If counter1 = 0 Then If currentWordLen = 7 Then letterPicbox7.Location = New Point(80, 100) counter1 += 1 End If ElseIf counter1 = 1 Then If currentWordLen = 7 Then letterPicbox7.Location = New Point(160, 100) counter1 += 1 End If ElseIf counter1 = 2 Then If currentWordLen = 7 Then letterPicbox7.Location = New Point(240, 100) counter1 += 1 End If ElseIf counter1 = 3 Then If currentWordLen = 7 Then letterPicbox7.Location = New Point(320, 100) counter1 += 1 End If ElseIf counter1 = 4 Then If currentWordLen = 7 Then letterPicbox7.Location = New Point(400, 100) counter1 += 1 End If ElseIf counter1 = 5 Then If currentWordLen = 7 Then letterPicbox7.Location = New Point(480, 100) counter1 += 1 End If ElseIf counter1 = 6 Then If currentWordLen = 7 Then letterPicbox7.Location = New Point(560, 100) counter1 += 1 End If End If End If End If
I don't know if I just missed out some code since it's too long. Or my logic wasn't that good to perform what I want with my letters. If anyone can provide me a better logic or even a suggestion. I will be fully thankful! THANKS!
Last edited by a moderator: