O'Reilly logo

Real-World Flash Game Development, 2nd Edition by Christopher Griffith

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

12

DON’T HIT ME: COLLISION DETECTION TECHNIQUES

CHAPTER OUTLINE

What You Can Do versus What You Need

HitTestObject—The Most Basic Detection

HitTestPoint—One Step Up

Radius/Distance Testing—Great for Circles

Rect Testing

The Enemy Class

The SimpleShooterCollisions Class Additions

Weaknesses of This Method

Pixel-Perfect Collision Detectionand Physics

When All Else Fails, Mix ‘N Match

If you do much game development, you’ll eventually need to determine when two objects on screen are colliding with one another. Although Flash does not automatically notify you of this, there are a number of different methods that can be used to detect it. In this chapter, we’ll look at several types of collision detection and in which scenarios they work best. We’ll ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required