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
From the course: Building Flash Games with Starling
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
Adding the background1m 3s
-
Creating the Hero class6m 14s
-
Creating the Bullet class1m 44s
-
Creating the BulletManager class4m 23s
-
Using the StarlingPool class9m 24s
-
Firing bullets with the mouse7m 24s
-
Creating the Alien movie clip1m 58s
-
Creating the AlienManager class8m 12s
-
Overview of collision-detection options3m 10s
-
Creating the CollisionManager class10m 51s
-
Implementing the destroy method2m 24s
-
-
-
-
-