I have created a Ping Pong game with collision this week 😛
The bat is controlled by the x, y position of the mouse. The number of Ping Pong balls that are not touched by the bat will be displayed in the background. When the number reaches 20, the game is over.
In order to keep the webpage smooth, I wrote a “checkEdges” function that uses splice to remove each ball when it is out of the window.
Demo: