0

Can someone help me with the brick collision?

I've done the entire code up to collision. (WHICH GETS ME EVERY TIME!!!). First of all, the collision won't even register. Second of all, when it did, it just goes back in the same direction. Somehow I need to test if the ball hits the top/bottom (then y speed *= -1), and the left/right (then x speed *= -1). What's the point in even doing this? I've doing this for over a year and still can't do basic collision! https://code.sololearn.com/WiFwPgbR5OS4/?ref=app

3rd Jul 2020, 4:53 PM
Clueless Coder
Clueless Coder - avatar
2 Réponses
+ 1
You basically had it all correct. here's an example of it working. https://code.sololearn.com/W42ZCM1Gb5Ku/#js
3rd Jul 2020, 8:08 PM
JME
0
JME Wow. Just wow. I would never have got that. Thanks so much for the help!
3rd Jul 2020, 8:13 PM
Clueless Coder
Clueless Coder - avatar