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.

DarkBASIC Discussion / Control keys not working?

Author
Message
Dia
20
Years of Service
User Offline
Joined: 16th Jan 2005
Location:
Posted: 26th May 2006 09:06
Heya all, I was wondering if some keys take precedence over another?

for example, I have the following control for an aircraft

w - pitch down
s - pitch up
a - yaw left
d - yaw right
q - bank left
e - bank right

I am using keystate() commands to manouevre my aircraft. Individually, there is no problem with these commands, but using particular keys at the same time sometimes runs into problems.

THe main example is if I try to pitch forward, and bank right at the same time, (w and e keys together). If I press w first, then pressing the e key has no effect (i.e. it wont bank - although I can use the q key to bank left). However if I have the e key pressed, then I am able to use the w and s to pitch quite happily

this is waht I am using:

Ravencast
19
Years of Service
User Offline
Joined: 11th Apr 2006
Location:
Posted: 27th May 2006 20:13 Edited at: 27th May 2006 20:15
perhaps im mistaken, but dont these lines:

if liftptch#<358 AND liftptch#>270 AND scancode()<>31 AND scancode()<>17
liftptch#=wrapvalue(liftptch#+2.5)
endif

if liftptch#>2 AND liftptch#<90 AND scancode()<>31 AND scancode()<>17
liftptch#=wrapvalue(liftptch#-2.5)
endif

state that it will only pitch is the "w"(17) and "s"(31) keys are not held down? at least, thats what it looks like =D correct me if im wrong

Raven

*edit*-lokking back, i wouls also say the reason it does pitch left is because the "q"(16) key is being pressed and that routine is called *before* it can tell whether the "q" or "s" key is pressed down

...and the brazen god of war cast up a mighty lord. to lead the savages forth!
Dia
20
Years of Service
User Offline
Joined: 16th Jan 2005
Location:
Posted: 28th May 2006 08:24
those two lines (as well as similar lines for banking) are to return the aircraft to an upright position if there is no pitch command (or bank command for banking)

I am still able to do most other key combinations, it is just the one mentioned above that causes me grief
Ravencast
19
Years of Service
User Offline
Joined: 11th Apr 2006
Location:
Posted: 28th May 2006 23:31
ah i see...my mistake =P other than that, id say its a system thing...perhaps the way it records keys being pressed down, but it doesnt look like a code problem

Raven

...and the brazen god of war cast up a mighty lord. to lead the savages forth!

Login to post a reply

Server time is: 2025-05-25 01:51:30
Your offset time is: 2025-05-25 01:51:30