Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / dbKeyState()

Author
Message
martianxx
13
Years of Service
User Offline
Joined: 19th Feb 2011
Location:
Posted: 19th Feb 2011 13:37
Hi I havn't been using Dark GKD for very long and am wandering how I would go about using the dbKeyState(int) function to be used for a conditional statement that is only satisfied when two keys are being pressed.

My first thought was:



After some thought (and it not working) i thought that this isnt going to be satisfied since when both are pressed i am guessing the code is different. So what i'm asking is what can I do to make this work. The idea is for my animated sprite to jump up and right when this combanation is pressed. I have the code for making the image move in the right way (go up to a certain height then come down to the ground) I have tested by making both returns = to true its just getting this right. Any help would be appreciated.
enderleit
17
Years of Service
User Offline
Joined: 30th May 2007
Location: Denmark
Posted: 19th Feb 2011 22:02
This should work as each key has its own internal "register", so if you check keystate(200) && keystate(205) and both = 1 then they are both pressed and the IF statement should be TRUE...

Anyone else got a reason why this wouldn't work?

Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 20th Feb 2011 11:19 Edited at: 20th Feb 2011 11:42
It should work. I checked and it works on my machine.

P.S. Have you tried if you can detect two other keys (not the arrows) pressed at the same time? Maybe your keyboard is not willing to detect certain key combinations.
Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 20th Feb 2011 12:44
Might be your keyboard, for example my old keyboard didnt permit me to do just that.

martianxx
13
Years of Service
User Offline
Joined: 19th Feb 2011
Location:
Posted: 20th Feb 2011 20:23
Ill, have a look and get back, dont have the time right now unfortunatly. If it should work ill look again for errors elsewhere.

Login to post a reply

Server time is: 2024-10-02 15:26:38
Your offset time is: 2024-10-02 15:26:38