Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2
Because when you draw rectangles on top of each other, you don't hide the old ones, they are always there in white. After each loop, draw a black rectangle on top of the previous position of the box, to do that, add this line at the end of your draweverything function: canvascontext.fillStyle = "black"; canvascontext.fillRect(ballx-10, 300, 10, 10);
27th Oct 2019, 11:41 PM
Aymane Boukrouh
Aymane Boukrouh - avatar