How Javascript listens for keyboard and mouse click events and invokes event handlers at the same time

I want to make a simple Mini Game

similar to tank wars

requires keyboard control to move

Mouse click to fire bullets in the target direction

however, when you control the movement, you can"t fire the bullet. You need to stop the movement, and then click to fire the bullet

.

want to know how to solve this problem


almost does not exist at the same time, it is executed as a queue in js, but the interval between the two events is very short.
the effect you said should be OK, I don't know if you use unity or what to write the game


if you are long pressing the keyboard and have been rendering, in fact, mouseclick is triggered, but because of single thread, waiting for your keyboard event to be processed.
you can choose to add some throttling to the event and don't let the event trigger all the time.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea645c-47b88.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea645c-47b88.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?