News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

is there a way of scanning 2 keys pressed at the same time from basic?

Started by the777, Yesterday at 10:17

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

the777

maybe with a few peeks? ive had a look on google and they all seem to be machine code routines

pelrun

Use INKEY() (not INKEY$) to check whether a specific key is pressed or not; you can use it multiple times to check as many keys as you like.

https://www.cpcwiki.eu/index.php/Locomotive_BASIC#INKEY_.28.3Cinteger_expression.3E.29

Jean-Marie

10 IF INKEY(58)+INKEY(50)=0 THEN 30
20 GOTO 10
30 PRINT"E and R keys have been pressed."
40 CALL &BB03


andycadley

Remember that once you get to three or more keys, there are some combinations that will generate false results. 

ZorrO

10 DEFINT a-z:' You can load screen here

20 IF INKEY(1)=0THEN t=t+1ELSE IF INKEY(8 )=0THEN t=t-1
30 IF INKEY(0)=0THEN t=t-40ELSE IF INKEY(2)=0THEN t=t+40
40 t=(t+1024)MOD 1024:v=48+t\256:w=t MOD 256:OUT&BC00,13:OUT&BD00,w:CALL&BD19:OUT&BC00,12:OUT&BD00,v:GOTO 20

And now try arrow keys to move screen in 8 directions. :)
CPC+PSX 4ever

Powered by SMFPacks Menu Editor Mod