One of the most important features of any action game is collision; sadly it is usually one of the weakest points in most flash games. One reason for this is that many programmers rely upon the built-in hittest method, which is extremely limited: it works only with axis-aligned rectangles or points, and returns only a boolean result.
While a simple yes/no result is sufficient in some cases, many applications (like racing games) really do require extra information about collisions when they occur, in order to respond to the collision in a meaningful way. Often this extra information is implicitly found by testing multiple positions for collision, in order to infer information about the collision; from several yes/no results, a more detailed model of what’s happening can be built. However, this awkward (ab)use of the built-in collision functions undermines the entire process – if you need to hittest multiple times (at different points) for each collision, the built-in methods cease to outperform “real” collision detection methods. It’s time to think about doing it the right way.
This presentation will introduce some useful tools for solving the collision problem quickly and accurately, including use of the seperating-axis-theorem to test two shapes, as well as higher-level data structures and approaches which will reduce the number of tests needed.