Note About This Book: Advanced Lingo For Games was written by Gary Rosenzweig in 2000 for users of Macromedia Director 7. It is presented here for free on an as-is basis, with no updating. Most of the information and code here can be used in the most recent version of Director. The book has been reproduced from the final editing files archived in 2000, and not the final proof galleys. So some minor differences between this version and the printed version my exist. The entire contents of this book are Copyright 2000, Gary Rosenzweig. No part may be reproduced or copied without written permission. The text here is provided for individual use only.
Want to thank me for making this book available for free? Just buy Special Edition Using Macromedia Director MX and we'll call it even!

Advanced Lingo For Games
by Gary Rosenzweig


Chapter 13 Section 5

Game Variations

The biggest way that you can vary a trivia game is through the questions. They can represent one topic or many. They can be easy or difficult. That can even use humor to lighten up the game.

Besides the questions, you can vary the mechanics of the game in several ways.

Number of Answers

This example movie uses four possible answers for each question. However, there is nothing in the code that specifies "four." You could just as easily use three. All you need to do is remove the fourth button and text member, and make sure that there were only three answers listed for each question in the database.

Levels of Play

When a set of questions is finished, the "pEndGameFrame" doesn't necessarily have to take the user to a "Game Over" frame. It can instead take them to another set of questions. You can then create multiple levels, with each level getting harder and harder.

With a little more coding, you could make the score cumulative instead of resetting after every frame. You can also count the number of correct answers on each level and only let the user move on to the next level if they get enough correct.

Randomizing the Questions

Instead of having a group of questions that get asked in the same order each time, you could have a large group of questions and have a random sampling of them asked. This would involve using the random function to choose a random question instead of using the "pQuestionNum" property.

To make sure that a question is not asked twice, you could store the number of each question asked in a list, and then use getOne to check to see if the question has already been asked. It would look something like this:


repeat while TRUE
  r = random(pDataMember.text.line.count)
  if not getOne(pAlreadyUsedList,r) then exit repeat
end repeat
add pAlreadyUsedList, r
text = pDataMember.text.line[r]

You must remember to initialize "pAlreadyUsedList" by setting it to [] in the on beginSprite handler. You also have to add it to the property declarations at the start of the behavior.

If you look at the example on the CD-ROM, you will see that there is also a frame with this type of game on it. The behavior is called "Random Trivia Game Frame Behavior" and you can look at it to see the exact changes that were made to randomize the questions. If you turn off script coloring before loading the movie, the new lines show up in red.

You can also use a similar technique to randomize the order of the answers.

The Clock Is Ticking

One simple improvement would be a looping "tick" sound on the game frame. This should make it sound like a clock is ticking and increase the feeling of urgency.