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 / wsad keys

Author
Message
XoM
19
Years of Service
User Offline
Joined: 28th May 2005
Location:
Posted: 30th May 2005 09:34
does anyone know how to use the wsad keys....
ive tried everything inkey(),scancode(),and keystate()

can anyone help me!!??

-devan buggay
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 30th May 2005 11:20
XoM,

I'm not sure why you are having such a hard time implementing the use of these buttons. The scancodes for each are below.

w = 17
a = 30
s = 31
d = 32

To use this in code, simply use an IF statement to execute specific lines of code.



If you need to know a specific scancode number for a specific key, run this code below, pressing keys to see their code.




+NanoBrain+
XoM
19
Years of Service
User Offline
Joined: 28th May 2005
Location:
Posted: 30th May 2005 11:35
but what if the user where to press multiple keys....
thats where mine lags
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 30th May 2005 20:47
how about this?

if inkey$() = "w" then blabla
if inkey$() = "s" then blabalbla
if inkey$() = "a" then blaala
if inkey$() = "d" then bllla
...

Good luck
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 30th May 2005 20:49
By the way: I think your pc will never allow you to press 3 keys at the same time... But 2 at the same time works fine with the inkey$() command
XoM
19
Years of Service
User Offline
Joined: 28th May 2005
Location:
Posted: 31st May 2005 01:48
that works!!! thx sven b


-devan buggay
Link102
20
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 31st May 2005 03:35
I always use this code


please reply
XoM
19
Years of Service
User Offline
Joined: 28th May 2005
Location:
Posted: 31st May 2005 08:16
thx everyone! my strafing and the use of the wsad keys are working
but now all i need is to make it so when you press the tab key you switch weapons....

does anyone have any ideas?

thx

-devan buggay
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 31st May 2005 08:52 Edited at: 31st May 2005 08:53
XoM,

The code snippet below should help you. It is fully commented to step you through its processes and help you understand the method and how to use it. It's simple, really.




+NanoBrain+
XoM
19
Years of Service
User Offline
Joined: 28th May 2005
Location:
Posted: 31st May 2005 11:21
thx nanobrain! that helped alot!
XoM
19
Years of Service
User Offline
Joined: 28th May 2005
Location:
Posted: 31st May 2005 12:45
thx nanobrain, that helps
but i still need to know how to position the gun on the
screen when you choose is because right now im using the
lock object on command

here is what i have so far.. plz comment

Attachments

Login to view attachments
snicko
21
Years of Service
User Offline
Joined: 22nd Mar 2004
Location:
Posted: 9th Jul 2005 05:45
If this is still relevant, try loading all the guns, locking them all on and hiding all but the current gun

Login to post a reply

Server time is: 2025-05-23 02:09:38
Your offset time is: 2025-05-23 02:09:38