0

How do I use W.A.S.D. as buttons.

22nd Jun 2020, 11:35 PM
bob
bob - avatar
2 Answers
+ 1
document.addEventListener('keydown', (e) => { console.log(e.keyCode) }) will log the keyCode of any key you press, from there you can use if statements to do specific actions based on what the key code is. A=65, D=68, S=83, W=87
23rd Jun 2020, 6:54 AM
JME
+ 1
Thanks
23rd Jun 2020, 11:19 PM
bob
bob - avatar