Created
November 24, 2015 06:22
-
-
Save brandonjank/dc9de2f044b6e805acb2 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
x += velocity * Math.cos(angle * Math.PI /180); | |
y += velocity * Math.sin(angle * Math.PI /180); | |
if (x < 0 || x > canvas.width) { | |
angle = 180 - angle; | |
} | |
else if (y < 0 ||y > canvas.height) { | |
angle = 360 - angle; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment