Created
August 23, 2017 01:31
-
-
Save botrosg/d2bb38eaefda08add617a96af5c33f14 to your computer and use it in GitHub Desktop.
Revisions
-
botrosg created this gist
Aug 23, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ if(this.x - 5 < 0) { // hitting the left wall this.x = 5; this.x_speed = -this.x_speed; } else if(this.x + 5 > canvas.width) { // hitting the right wall this.x = canvas.width - this.radius; this.x_speed = -this.x_speed; }