I’m making a hangman game and I’m trying to figure out how to make only one letter in a string visible. I appreciate the help, I’ve spent an couple hours trying different things but just can’t narrow it down. Here is my code:
This is how I genrated the word using table wordList:
theWord = wordList[mRand]
currentWord = display.newText(theWord, 10, 100, “Times New Roman”, 20)
currentWord.isVisible = false
Here I check to see if there is an A in theWord (which works) the problem comes at the ‘else’ part of the argument… how to make the ‘A’ of currentWord visible?
function gamePlay(event)
local self = event.target
if self.name == “a” then
aa = string.find(theWord, string.upper(self.name))
if aa == nil then
hBody.isVisible = true
else
print("letter "… self.name … " found at position " … aa … " in word " … theWord )
currentWord.isVisible(aa) = true
end
end
end
Thanks!! [import]uid: 170524 topic_id: 30507 reply_id: 330507[/import]
