XNA Creators Club Online

beginner's guide

2D Lessons

1 Introducing the 2D Tutorial
2 Creating the Game Project
3 Adding Assets
4 Drawing the Background
5 Creating a Cannon
6 Firing Cannonballs
7 Adding Enemies
8 Destroying Enemies
9 Keeping Score
x Extra Credit - Community Tutorials

8. Destroying Enemies

Use rectangular collision to detect when cannonballs hit enemies, allowing the player to shoot down the UFOs with the cannonballs.


Step 1

Watch Video
Construct Rectangle objects around cannonballs and enemies, comparing them to determine if there are collisions, killing cannonballs and enemies that collide.
More Details
Download source code
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG