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.

2D All the way! / WASD movement

Author
Message
zDough BoyZ
18
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 1st Jun 2007 09:05
How would i change the code for "If UpKey" movement to "WKey" movement. so instead of moveing with Up Down Right Left arrows, i could move with WASD keys

The Internet Is TUBES
el zilcho
18
Years of Service
User Offline
Joined: 4th Dec 2006
Location:
Posted: 1st Jun 2007 13:56
if upkey()=1

goes to

if inkey$()="w"


if upkey()=0

goes to

if inkey()<>"w"

and so on for the rest of the keys
Zergei
20
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 1st Jun 2007 13:58
Use the command "keystate()" and specify within the brackets the key number associated with the letter you want. For the W would be:

if keystate(17)=true then ...

I atached a pic wich shows the key number for keys on the keyboard. Hope it helps.

Further on my stuff at...
el zilcho
18
Years of Service
User Offline
Joined: 4th Dec 2006
Location:
Posted: 1st Jun 2007 14:08
yes actually that would be better. because if you use the inkey or upkey etc commands, is sometimes messes up when you press 3 keys at a time.
zDough BoyZ
18
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 1st Jun 2007 20:23
great works perfect. thanks

The Internet Is TUBES

Login to post a reply

Server time is: 2025-08-09 02:16:02
Your offset time is: 2025-08-09 02:16:02