80 likes | 256 Views
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.
E N D
velocities of balls a boolean that is set to true when balls collide
screen (view) limits initial positions of balls size of ball images
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.
when a ball reaches a wall we simply reverse the sign of its velocity in the corresponding direction
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