Learn Create Your Own Split Screen

Next Page

Here's that line of code to rectify things.

It's placed inside the if-statement that detects the object being at or past the bottom of the canvas, and has the effect of moving the object back to the exact bottom. So it can never go past the bottom.

this.y = myCanvas.height - this.MyImg.height; // be exactly at the bottom

Seems reasonable, and now it never goes past the bottom. But now it's over-rebounding again.