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.

3 Dimensional Chat / wsad keys

Author
Message
XoM
19
Years of Service
User Offline
Joined: 28th May 2005
Location:
Posted: 30th May 2005 07:50
hi im new to programming and id light to know how to use the wsadd keys

ive tried inkey$(),scancode(),and keystate() but it makes the controls lag

can anyone help me!?!?

-devan
Seppuku Arts
Moderator
20
Years of Service
User Offline
Joined: 18th Aug 2004
Location: Cambridgeshire, England
Posted: 30th May 2005 09:08
tip, try Dark Basic Professional Chat/Dark Basic Chat,
this area is mainly for 3D modellers and welcome to the forums

Zone Chicken
20
Years of Service
User Offline
Joined: 25th Jan 2004
Location: `~-..-~`~-..-~`
Posted: 30th May 2005 10:30 Edited at: 30th May 2005 10:39
use scancodes with keystate

if scancode() = 17 and keystate(17) = 1
move camera 1
endif
if scancode() = 31 and keystate(31) = 1
move camera -1
endif
if scancode() = 32 and keystate(32) = 1
turn camera right .1
endif
if scancode() = 30 and keystate(30) = 1
turn camera left .1
endif

shouldn't make it lag, least it doesn't here.

Your signature has been erased by a mod -- please resize to under 600x120...
XoM
19
Years of Service
User Offline
Joined: 28th May 2005
Location:
Posted: 30th May 2005 10:41
thx zone chicken!
XoM
19
Years of Service
User Offline
Joined: 28th May 2005
Location:
Posted: 30th May 2005 10:42
what but in my game i make it so the camera strafes..... would it work if you pressed two keys at the same time?
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 30th May 2005 16:18
to make it strafe, use the "newxvalue" and "newzvalue" commands, look them up

example in my code: (spd# is the speed at which it will move, ca# is the y angle of the camera, cx# and cz# are the positions (just place the camera at cx and cz after this code))
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 30th May 2005 19:03
Personally what I do is store the current input in to an array and then use a constant system to see if they've been pressed.

You can figure out the ScanCode of a key with this



You could actually use the above to output all of your virtual key constants
Well I'd use the code below in order to check the keys.


By making sure you rely as little as possible on the built-in commands you can increase program speed dramatically

Login to post a reply

Server time is: 2024-11-27 18:38:00
Your offset time is: 2024-11-27 18:38:00