keydown for 2 keys

Blitz3D Forums/Blitz3D Beginners Area/keydown for 2 keys

767pilot(Posted 2004) [#1]
how can you check if 2keys are pressed ie right and up arrows

i tried 'if keydown(200) and keydown(205) then ' but doesnt work

thanks


GfK(Posted 2004) [#2]
Thats how its done. But some keyboard combinations don't work on certain hardware. It isn't Blitz's fault.


Perturbatio(Posted 2004) [#3]
you could try nesting them
i.e.

If Keydown(200) then
   If Keydown(205) then
     DoStuff()
   EndIf
Endif



Perturbatio(Posted 2004) [#4]
not that I would do a control system for a game like this, but this works fine for me:



767pilot(Posted 2004) [#5]
Doesnt work for me, man just goes up

ElseIf KeyDown(200) Then ;move up

If KeyHit(205) Then man\x =man\x +8
If KeyHit(203) Then man\x =man\x -8
blah blah

end if


WolRon(Posted 2004) [#6]
Write a seperate program that only checks keys and prints the results to the screen. This will tell you if the problem is with your hardware or if it's with your code.

Note that KeyHIT commands can only be used ONCE. If you need to perform several checks on a KeyHIT command than store it into a variable first.
down_key = KeyHit(208)
If down_key = True Then ...
If down_key = True Then ...
If down_key = False Then ...



gpete(Posted 2004) [#7]
GJ,

just put the "If Keydown(200)....If Keydown(205)" in seperate If/Endif statements. Blitz is so fast that you can press two keys at the same time and it will process the commands "virtually" simultaneously. You won't even notice the difference. I do it all the time!


jfk EO-11110(Posted 2004) [#8]
I don't see the reason why the seperate IF structure should help here. This is a OS issue as far as I know. It works on some systems, on some other systems it doesn't.