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

Chapter 11. Manipulating Information > Calculating Distances with the Math Obje...

Calculating Distances with the Math Object

Using the Pythagorean theorem, Flash makes it possible for you to calculate the distance between two objects. This technique can be useful for creating novel interactions between interface elements—for example, graphics, buttons, or sounds that react in proportion to their distance from the viewer's pointer. You can also create games that have interaction based on the distance between objects and the player. For example, a game where the player uses a net to catch goldfish in an aquarium can use the distance between the goldfish and the net to model the behavior of the goldfish. Perhaps the closer the net comes to one, the quicker it swims away.

The distance between any two points is defined by the equation


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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