Game Development Reference
In-Depth Information
might start to slow down your game. Still, it's a great solution, and there are very few collision detec-
tion problems you won't be able to solve by doing this judiciously.
All this is an art, not a science, and if you get the balance right you'll have an amazingly comfortable
and natural collision-detection system. Hooray for depPaopK^fa_p!
Using hitTestPoint
Another method you can use for collision detection, depPaopLkejp, allows you to see whether a single
point is touching the shape of another object. This time, I mean its actual shape , not just its bounding
box.
The best way to see how depPaopLkejp works is by trying it out in a practical example. In the next few
steps, you'll design a hilly background for the characters and use depPaopLkejp to prevent the lh]uan
object from moving off of it.
1. In the ejpan]_peraLh]ucnkqj`*bh] file, create a new layer in the timeline called background .
Position it in the layer stack so that it's below the layer on which you've designed your other
objects.
2. Use Flash's drawing tools to draw a curved hill behind your lh]uan, ajaiu and ]llha objects.
Mine looks like Figure 7-26 (the daisies are optional!).
Figure 7-26. Design a hilly background for your characters.
 
Search Nedrilad ::




Custom Search