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 / how to use ascii for movement

Author
Message
Dragoon
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location: Spijkenisse, Nederland
Posted: 10th Oct 2004 21:54
hi guys,

I've been trying to create the wsad movement using ascii, but so far no good. Here's the code I use (it works with arrows), maybe you know what's wrong.

Thanks in advance.
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 10th Oct 2004 22:11
WHOA! I say WHOA! there boy, hmm! seem to be talking like a cartoon character!! , lets start again...


ok, you can`t do that to upkey, upkey is for the upkey and nothing else, your chr$(x) commands will not do a logical compare, chr$(97) returns the ascii character 97, not 1, you need to use scancodes to control your game (they have the advantage that they can be read at the same time, unlike inkey$() ), if you want to control using scancodes then do this

do
if scancode(17) then move camera 20
if scancode(31) then move camera -20
if scancode(30) then angley#=angley#(wrapvalue-8.0)
if scancode(32) then angley#=angley#(wrapvalue+8.0)

yrotate camera angley#
loop

that will work, just get the correct scancode for the key you want to check and then test for that, theres a list of scancodes somewhere on this site but I have a printout in my manual front page of all the scancodes, someone have a link to the scancode chart?

Mentor.

PC1: P4 3ghz, 1gig mem, 3x160gig hd`s, Radeon 9800pro w cooler (3rd gfx card), 6 way speakers.
PC2: AMD 2ghz, 512mb ram, FX5200 ultra, 16 bit SB.
Mini ATX cases suck.
Dragoon
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location: Spijkenisse, Nederland
Posted: 10th Oct 2004 22:18
Thanks.

BTW, I found the scancode list.

http://forum.thegamecreators.com/?m=forum_view&t=10554&b=10

Login to post a reply

Server time is: 2025-05-24 16:56:20
Your offset time is: 2025-05-24 16:56:20