Why can't i control the rectangle using those buttons | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why can't i control the rectangle using those buttons

Game controller (buttons) https://code.sololearn.com/WKF6POXXc205/?ref=app

5th Jul 2022, 7:47 PM
Patrick agbenyo paul
Patrick agbenyo paul - avatar
3 Answers
+ 1
You didn't pass a value for "direction" in the drawPaddle(). Also you try to call drawPaddle() multiple times in draw()?
5th Jul 2022, 7:52 PM
Lisa
Lisa - avatar
0
Thks Please how control the rectangle using the buttons
5th Jul 2022, 7:55 PM
Patrick agbenyo paul
Patrick agbenyo paul - avatar
0
You are not listening for button click, you need to connect javacript function with button click, so when user click for example start game you run function to start game.... Here is more how to add event listeners, there are few ways to do it: https://www.w3schools.com/jsref/event_onclick.asp https://www.w3schools.com/jsref/met_element_addeventlistener.asp
5th Jul 2022, 8:50 PM
PanicS
PanicS - avatar