Skip to main content
Participating Frequently
April 23, 2014
Question

word guessing game Flash Develop as3

  • April 23, 2014
  • 1 reply
  • 1681 views

I am coding a word guessing game for primary level age 5/6. They have to guess a five letter word by looking at the image. I want to provide a clue button, which when clicked will give the user one correct letter. There are five words contained in an array. I want to give one letter as a clue. Here is my current code (not completed). If anyone has any ideas, they would be greatly appreciated as havn't done this before!!

}

                    public function clue(event:MouseEvent):void {

                              for (var  i : uint = 0; i < 5; i++)

                              {

                              if (this["text" + i].text != currentWord.charAt(i))

                                                  {

                                                            //changing colour to red

                                                            trace ("checking if equal");

                                                            this ["button" + i] = setImage("../images/red2.png", 405 + (40 * i), 600);

                                                            this["button" + i].visible = true;

                                                            //need to give the user one correct letter

                                                            ["Text"+i] == currentWord.charAt(i)

                    }

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
April 23, 2014

What is the function you show supposed to be doing and what are the different parts of it that you target?

Participating Frequently
April 24, 2014

There is a clue button that when clicked will give the user one correct letter out of 5 letters in the word such as apple. When they click the check button a circle under each letter will show up red for wrong and yellow for right.If a letter is wrong the user can click clue and be given one correct letter in the word apple for example.I have previously coded how to check each letter in the word and produce the colour circle underneath. I was trying similar code to try and select one letter from the word in the array(such as apple) and display it in the correct place in the textfield. However this is beyond me too!!

public function clue(event:MouseEvent):void {

                              for (var  i : uint = 0; i < 5; i++)

 

                              if (this["text" + i].text != currentLetter.charAt(i))

                              {

                                                            trace ("checking if equal");

                                        positionInWord = (Math.floor(Math.random() * currentWord.length));

                                        currentLetter = WordList[positionInWord];

                                        trace(currentLetter);

 

                                                            //need to give the user one correct letter

                                                            //["text" + i].text = currentWord.charAt(i)

                              }

Ned Murphy
Legend
April 24, 2014

The story isn't that much different from the first go around.  The problem is that you still haven't explained how the code relates to the story... what pieces of the code represent what?  I'd rather not try to guess what the currentLetter thing is or what this["text"+i... represents.  Then there's currentWord and WordList jumping in there as well.  It is possible that if you explain all those you might find a light going off that leads you to finding the problem without having to finish asking further.