+ 1

Using the spacebar to play

Hey, I am wondering if I can use the spacebar as controls. The problem is that if I use the spacebar, it usually resets the program. Is there anyway for the spacebar not to reset the program? Thank you.

15th Jun 2022, 4:48 AM
Skip_The_Ace
Skip_The_Ace - avatar
2 odpowiedzi
+ 4
Yes. You can code the desired action in the Keydown event callback function. JS Keydown Event Listener https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key Because I am using SoloLearn mobile app, instead of keydown event, I used Mouse Click Event to demonstrate how to swap callback function. https://code.sololearn.com/WX5Yv2zlP9JY/?ref=app
15th Jun 2022, 5:26 AM
Gordon
Gordon - avatar
+ 2
https://code.sololearn.com/WhoIE9Xu2M28/?ref=app https://code.sololearn.com/WhHCxetjRzTm/?ref=app
15th Jun 2022, 6:50 AM
Calviղ
Calviղ - avatar