From the course: Building Flash Games with Starling

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Overview of collision-detection options

Overview of collision-detection options

From the course: Building Flash Games with Starling

Start my 1-month free trial

Overview of collision-detection options

So before we go and actually implement collision detection into our game, I wanted to go over a couple of the options which you have for collision detection. So the simplest is called bounding box collision detection and you can see in this example here, I have my alien and I have my hero ship, and essentially, there are rectangles around them that denote the bounds. So anytime I overlap the two, we can see they turn red here. This is the simplest form of collision detection that's actually useful for a lot of things, because remember in our game, the aliens are moving downwards. So if we want to test between the aliens and the ship, this is actually pretty good, and for the most case since things are moving so fast, this would actually work fairly well. Now obviously, if you had a big graphic that had all kinds of intricate shapes, and you wanted to really test in a more accurate way, then things would break down. But this is the simplest and the fastest way to do collision detection…

Contents