BBC BASIC for Windows
« Detecting simultaneous key presses »
Welcome Guest. Please Login or Register. Apr 5th, 2018, 10:49pm
ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018. Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.
If you require a dump of the post on your message board, please come to the support board and request it.
Could someone let me know how to detect, for example if the letter j and letter f is pressed at the same time?
Like this:
Code:
IF INKEY(-70) AND INKEY(-68) THEN
(the various INKEY codes are in the manual, or right-click on INKEY in the editor and select What's This?).
Beware that the test will work even if your window doesn't have 'focus' which can occasionally be inconvenient. If so there is code in the manual for checking for input focus:
Also be aware that you cannot reliably test for more than two keys pressed at the same time (it may sometimes work for three, or even four, keys but it depends on the keys and it depends on the keyboard!).