Created
July 10, 2013 02:37
-
-
Save nklsrh/5963036 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
// resets the ball's position to the centre of the play area | |
// also sets the ball direction speed towards the last point winner | |
function resetBall(loser) | |
{ | |
// position the ball in the center of the table | |
ball.position.x = 0; | |
ball.position.y = 0; | |
// if player lost the last point, we send the ball to opponent | |
if (loser == 1) | |
{ | |
ballDirX = -1; | |
} | |
// else if opponent lost, we send ball to player | |
else | |
{ | |
ballDirX = 1; | |
} | |
// set the ball to move +ve in y plane (towards left from the camera) | |
ballDirY = 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment