Created
July 10, 2013 02:40
-
-
Save nklsrh/5963056 to your computer and use it in GitHub Desktop.
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
// and if ball is travelling towards player (-ve direction) | |
if (ballDirX < 0) | |
{ | |
// stretch the paddle to indicate a hit | |
paddle1.scale.y = 15; | |
// switch direction of ball travel to create bounce | |
ballDirX = -ballDirX; | |
// we impact ball angle when hitting it | |
// this is not realistic physics, just spices up the gameplay | |
// allows you to 'slice' the ball to beat the opponent | |
ballDirY -= paddle1DirY * 0.7; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment