Trapping two keys
#5
To demo what Mark is gettting at...

Code: (Select All)
DO
    _LIMIT 30
    IF _KEYDOWN(18432) THEN h = -1 ELSE h = 0
    IF _KEYDOWN(19200) THEN i = -1 ELSE i = 0
    IF h * i = 1 THEN PRINT "Both keys down." ELSE IF LEN(INKEY$) THEN CLS
    _KEYCLEAR
LOOP


I threw in the INKEY$ statement just to only clear the screen when a key is pressed, other than the combo you wanted, arrow up and left.

Now if you hold both down, the process will repeat. If you only want one event, then do this...

Code: (Select All)
DO
    _LIMIT 30
    IF _KEYDOWN(18432) THEN h = -1 ELSE h = 0
    IF _KEYDOWN(19200) THEN i = -1 ELSE i = 0
    IF h * i = 1 AND flag = 0 THEN
        PRINT "Both keys down."
        flag = -1
    ELSE
        IF h * i = 0 THEN flag = 0: CLS
    END IF
    _KEYCLEAR
LOOP

Hope that helps.

Pete
Reply


Messages In This Thread
Trapping two keys - by PhilOfPerth - 10-01-2022, 01:52 AM
RE: Trapping two keys - by bplus - 10-01-2022, 01:59 AM
RE: Trapping two keys - by PhilOfPerth - 10-01-2022, 02:08 AM
RE: Trapping two keys - by bplus - 10-01-2022, 02:26 AM
RE: Trapping two keys - by Pete - 10-01-2022, 02:38 AM
RE: Trapping two keys - by PhilOfPerth - 10-01-2022, 08:05 AM
RE: Trapping two keys - by Pete - 10-01-2022, 01:07 PM
RE: Trapping two keys - by bplus - 10-01-2022, 03:33 PM
RE: Trapping two keys - by Pete - 10-01-2022, 04:19 PM
RE: Trapping two keys - by PhilOfPerth - 10-01-2022, 11:24 PM
RE: Trapping two keys - by PhilOfPerth - 10-02-2022, 12:04 AM
RE: Trapping two keys - by bplus - 10-02-2022, 01:41 AM
RE: Trapping two keys - by Pete - 10-02-2022, 02:00 AM
RE: Trapping two keys - by PhilOfPerth - 10-02-2022, 02:34 AM
RE: Trapping two keys - by bplus - 10-02-2022, 05:20 PM
RE: Trapping two keys - by mnrvovrfc - 10-02-2022, 07:51 PM
RE: Trapping two keys - by Pete - 10-02-2022, 05:51 PM
RE: Trapping two keys - by James D Jarvis - 10-02-2022, 07:56 PM
RE: Trapping two keys - by bplus - 10-02-2022, 07:58 PM



Users browsing this thread: 7 Guest(s)