1. Computing
Send to a Friend via Email

Finishing up the Game


1 of 3

Collision Detection

Finally, all the pieces are in place for your game. You've learned how to create a game window in Rubygame. You can load and display images on the screen. You can move these images around. You can even arrange these images on the screeninto meaningful groups. The last thing you need to make this a "game" is collision detection.

Collision detection tells us what sprites are touching each other. It tells us which aliens are being hit by our lasers, which of the alien plasma beams are hitting our player and gives us a chance to react to this. Collision detection is where all the interaction comes in.

Before getting started, be sure to download the part 3 example files. This is a different file than those used in the previous gaming articles, so you'll need to download the file using the above link. Note that all pixel art (such as the player, aliens and bullets) were created by Pixel_Outlaw.

©2014 About.com. All rights reserved.