Game Development Reference
But if you are a code junkie, read on! Flip back a few pages to Figure 7-36 and try to become familiar
with the problem you need to solve. If you understand the problem and the logic used to solve it, all
the new code does is to turn that logic into AS3.0 code. In fact, the problem you face is exactly the
same as the problem you faced in Chapter 6 when you were figuring out screen boundaries. The only
difference is that the calculations that you need to make to figure out how far these boundaries have
been breached are a little more complex.
Let's walk the through the ?khheoekj class and have a look at what's new and how it works:
1. Double-click the Collision.as file in the Project panel to open it.
2. You'll notice quite a lot of code there that you won't understand (you'll look at most of it in
later chapters). All you're interested in now is the ^hk_g function definition, which is the first
function definition in the class. Here's what the ?khheoekj class and the ^hk_g function defini-
tion look like: