Forum post: https://scratch.mit.edu/discuss/topic/838877/?page=1#post-8715652
Huge credit to @MARSAL_VED_VIL for fixing the ball code!