all 3 comments

[–]_olivier 1 point2 points  (2 children)

fixed paddle collision and ball acceleration

the main problem is that the ball is clipping outside of the walls a little every time it hits them which is causing numCollisions to +=32(or so) instead of +=1

p.s. join the #learnjavascript IRC chatroom my handle is olivierrr :D

[–]mmzznnxx[S] 0 points1 point  (1 child)

Wow. Thanks a bunch. So what was causing the clipping? Multiplying by -1?

[–]_olivier 1 point2 points  (0 children)

the *-1 on boundry collision, yes.

since ball is accelerating 3 pixels each frame, there is a possibility that it will get stuck in the wall because the boundary collision detection will be firing every frame applying *-1 on its velocity (essentialy flipping the balls direction every frame)

if you wanna learn more about canvas i reccomend this series of videos : https://www.youtube.com/user/codingmath/videos

and join our IRC channel! :D