1 / 8

Collision Detection

Collision Detection. velocities of balls. a boolean that is set to true when balls collide. screen (view) limits. initial positions of balls. size of ball images. ball.png. in this example the balls overlap for three consecutive frames.

aida
Download Presentation

Collision Detection

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Collision Detection

  2. velocities of balls a boolean that is set to true when balls collide

  3. screen (view) limits initial positions of balls size of ball images

  4. ball.png

  5. in this example the balls overlap for three consecutive frames Rather than just checking to see if the two balls are overlapping we also need to see if they already collided and are still overlapping. Initially bunched = false. When balls collide bunched gets set to true and remains true until the two balls separate (i.e. no longer overlap). This is important to ensure that the "doh" sounds gets activated only once per collision.

  6. when a ball reaches a wall we simply reverse the sign of its velocity in the corresponding direction

  7. using Color.White hear leaves the sprite color unaffected. Using any other color will shade the sprite in the select color value. rectangle indicating the size of the image being used. location in the view of the object being drawn bitmap (or png) of the image being drawn

  8. DOH!

More Related