Wordsearch game: fixed number of words?
Currently, the wordsearch game, generates games in which the number of words in each game varies. This is because the algorithm loops through a list of words, only once, finding a place for each word as it comes up. If after a number of tries, a particular word isn't placed, it's skipped over.
Why did I do it this way? It seemed like the fastest way to generate the games. Since I envisioned this application being used primarily by school teachers, I assumed that many would be on a slower machine, so speed was a big concern here.
If you'd like to take a look at the source FLA, it's available for download. I've been a little preoccupied with other projects, so I haven't finished the conversion to MX. This is one application that, I think, would really benefit from the advances in MX.
The next version, could very well have a user option for setting a fixed number of words per game. With the new event models, that should be a lot easier to set up.
Comments
Hi Kristin,
just thought of another problem i have had with the wordsearch game,
I was wondering how to count how many words there were in the game so that when the user gets all the words a correct page appears.
cheers
Matt
Posted by: matt g | July 14, 2002 12:23 PM
Hi Kristin,
RE: my last post about the correct/win page - I have figured it out now.
cheers
Matt G
Posted by: mattg | July 14, 2002 01:39 PM
Hi Matt,
I'm not sure if it's in the file I posted, but there was an score-keeping method, and I was planning to post a request somewhere for "you win" animations from designers...never got around to it, though. That would be a lot of fun, to have a random victory animation play at the end of a game. They'd have to be very short, and small file size.
Posted by: Kristin | July 14, 2002 03:33 PM
Kristin - here is what i did to get to the win page in the word search game.
----
In the showGuess function I added a variable called answer_count. It adds 1 to itself each time it is called to count the number of answers.
level0.answer_count = _level0.answer_count+1;
----
Then on the frame where the game starts I used this code
if (_level0.content.scroll.holder.word_holder0.word == null) {
_level0.content.crap = "0 is null";
_level0.content.answer_total = 0;
} else if (_level0.content.scroll.holder.word_holder1.word == null) {
_level0.content.crap = "1 is null";
_level0.content.answer_total = 1;
} else if (_level0.content.scroll.holder.word_holder2.word == null) {
_level0.content.crap = "2 is null";
_level0.content.answer_total = 2;
up to word holder 20. (im sure there is a better way of writing this but I am no expert)
at the end of all the if statements I used this code:
if (_level0.answer_count == _level0.answer_total) {
tellTarget (_level0.content) {
gotoAndStop("win");
}
}
stop();
and thats it.. its rough but it works.
cheers
Matt
Posted by: matt | July 31, 2002 01:05 PM