• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Lesson 19. Advanced Navigation > Testing Conditions with Lingo

Testing Conditions with Lingo

So far, your Lingo programming has been constrained to responding to events in a straightforward manner—the event happens, therefore the movie does something. Frequently, however, programs are more complex than that. Frequently you will need to gather information and take action based on that information: Is the movie playing on a system running at only 8-bit color depth? Then show graphics designed for 8-bit. Does the game player have enough power left to fire masers? If not, then disable the maser function.

Director provides several methods for testing whether some condition is true or not. Among these is the if-then-else construct. Using if with the elements then and else, you can have Lingo test whether a condition exists and respond accordingly. An everyday example of a condition you could test for is whether to turn a light bulb on or off: If it is dark, then turn on the light; otherwise, turn off the light. Here's how the if-then-else block would look if you could actually write Lingo to turn a light on or off:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint