HTML Canvas event listener | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

HTML Canvas event listener

I'm working on making a pong game. The code is: https://code.sololearn.com/WfuSxs2MWhJr/#html I'm wondering if you can add an event listener to the canvas and make it so when you click on say the top left it would move the left paddle up. And if you clicked the left down part of the canvas it would move the left paddle down and the same for the right paddle. So is there anyway to "split" the canvas into 4 parts each with a way to tell which part has been clicked.

8th Jun 2018, 7:59 PM
Ole113
Ole113 - avatar
1 Answer
+ 1
Thanks @ Brent Meeusen
9th Jun 2018, 7:44 PM
Ole113
Ole113 - avatar