Created
October 1, 2011 09:48
-
-
Save shameerc/1255816 to your computer and use it in GitHub Desktop.
Collision detection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// collission detection logic | |
function checkCollision(){ | |
if(ball.y+radius==C_HEIGHT && ( | |
(ball.x < bar.x) || (bar.x + barWidth) < ball.x ) ){ | |
stopGame(); | |
} | |
else if(ball.y+radius==C_HEIGHT ){ | |
updatePonits(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment