In my hangman program, I'm trying to use an array to detect if a letter has been pressed before, and therefore cannot be pressed again.
In my attempt to do this, I have tried using:
If targetarray[LastLetter] = 1 Then
Where 'LastLetter' is my variable.
In another section of my code I also have the arrays stored as such:
Sub LetterArrays
If GraphicsWindow.LastKey = "a" Then
targetarray["a"] = 1
ElseIf GraphicsWindow.LastKey = "b" Then
targetarray["b"] = 1
And so on...
The sub that the initial code checking if the letter = 1 is inside a sub that is called when a letter is pressed (GraphicsWindow.KeyDown
) and before my if clause, I used: targetarray[LastLetter] = 1
as my way of setting the letter in the array to 1.
If this makes sense to you and you have a solution, thank you very much.