Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Chapter 28, Pixel-Perfect Collision Detection in 2D

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
20,439
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Aug 8, 2007

A video of one of the examples in my new book on writing games for Windows and the Xbox 360 game console using XNA Game Studio Express.

Category:

Entertainment

Tags:

License:

Standard YouTube License

  • likes, 12 dislikes

Link to this comment:

Share to:

Uploader Comments (groundh0g)

  • Not that hard this is 1 line of code

  • @0ChrisMackle0 Really? Enlighten us. What would that one line be?

  • nice, but for a pixel perfect detection demonstration, one would think you would chose some model other then a circle:)

  • @avion85 Agreed. I'm not much of an artist, though. :)

Top Comments

  • Really? Circles is simple. I thought you would have more complex shapes. Simple collision.

    if(sqrt(((x1-x2)*(x1-x2))+((y1­-y2)*(y1-y2)))) <= diameter1 + diameter2){ return(true);

    }

see all

All Comments (41)

Sign In or Sign Up now to post a comment!
  • @groundh0g If boundingCircle.Intersect(bound­ingCircle2)) collided = true;

  • @groundh0g for(int i = 0; i < spheres.size(); i++) if( (cursor.pos-spheres[i].pos).le­ngth() < spheres[i].radius ) hit(i)

  • @groundh0g you simply check the distance from the center of the circle to the centre of the other circle and see if its less than the radius of one plus the radius of the other. I'm not sure if that's what you've done, but that's all you've demonstrated. Circles are easy - if you want to demo your code, you need to use more abstract shapes.

  • @groundh0g hes talking about pythagorean theorum

  • @1dantheman100 agreed, pixel perfect hahaha, try doing it with an animated sprite as well, which frame do you have to check intersection on? static images are simplistic

  • can ny1 temme hw to appy...same collision for maze..im new to game programming...

  • did you use true pixel perfect detection or radial space? the video uses circles so it's difficult to know visually

  • @groundh0g The first thing you should know is the people who are commenting as such are probably not going to be your customer base as we already know how to code. Second, if your potential customers are coming here they probably don't want to see the author in a furry on his own videos.

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more