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.

Newcomers DBPro Corner / Input from more than 1 key at a time

Author
Message
Basic brain
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location:
Posted: 10th Jan 2005 16:12 Edited at: 10th Jan 2005 16:44
I'm still trying to learn my way around DBPro (struggling really). This weekend I've been playing around with creating a matrix, then getting the camera to move around on it. (I've put my code so far in with this post)



Two questions really...

1. The camera won't move forward and to the side (or backward and to the side) at the same time i.e. If I'm holding down w and then hit e it stops dead and rotates right. I thought about using a Do / while lopp...something like while inkey$()="w" move camera...but can't figure out how to to do this....DBPro help was less than helpful...searched & couldn't find a previous post about this...

2. Second (sorry if this has already been posted) how can I get the camera to stay at the same height off the ground (I know it's something to do with get groundlevel...but again help was as useful as a chocolate teapot)

Many thanks...
Flashing Blade
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 10th Jan 2005 19:02 Edited at: 10th Jan 2005 19:02
Each key has a scancode value. "q" is 16 "s" is 31

now instead of
if inkey$="q"...
if inkey$="s"...
use
if keystate(16)...
if keystate(31)...

to find the scancode of any key do this:
do
cls
print scancode()
loop


The word "Gullible" cannot be found in any English Dictionary.
Dodo
20
Years of Service
User Offline
Joined: 8th Aug 2004
Location: eating lunch
Posted: 11th Jan 2005 00:58
and as for the matrix...



you should put this code at the end of your loop, when you have finished moving the camera.

Hope this helps

Part of solving the problem is actually noticing that the problem is there in the first place

ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 11th Jan 2005 05:31 Edited at: 11th Jan 2005 05:31
See attached for a scancode chart. It is my bible.

#Edit, or just looky here:



http://www.dbspot.com/NYC
New years competition... Fo Shizzle.

Attachments

Login to view attachments
raar
20
Years of Service
User Offline
Joined: 9th Jul 2004
Location:
Posted: 11th Jan 2005 05:43
mms someone know what ll happen when ya use azerty keyboard (yes some of us still have those :s)
will scancode of a be 30 or the code of q: 16 ?
if it stays the one for a, a game made with that key will give problems on an other kind of keyboard.
MSon
20
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 11th Jan 2005 07:45 Edited at: 11th Jan 2005 07:45
I find this is a simply way to find a scancode
Basic brain
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location:
Posted: 12th Jan 2005 00:13
Thanks.
I'm at work at the moment, but I'll give that a try when I get home...
Looking at that table the scancodes are different to the ascii codes. Seems weird...why doesn't DBPro just use ascii?
Basic brain
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location:
Posted: 14th Jan 2005 00:43 Edited at: 14th Jan 2005 00:45
Flashing Blade - that worked like a charm - thanks!

Dodo - dude your code did some strange things....

The camera starts off way up above the matrix. If you hit the downkey a couple of times, you can just about see the top of my two cubes sticking up out of the fog.
The w key now moves me down in a straight line (rather than forward in the direction the camera is pointing) - and vice versa for the s key.
I've no idea why it's doing that (I think I actually understand what your three lines are doing)...

Here's my code - try it out...

Dom
20
Years of Service
User Offline
Joined: 31st May 2004
Location:
Posted: 14th Jan 2005 01:52
Hey ReD_Eye Thanks for the table


Thanks to Animeblood for the Logo!
Dodo
20
Years of Service
User Offline
Joined: 8th Aug 2004
Location: eating lunch
Posted: 14th Jan 2005 02:17
your code works fine here Basic Brain, perhaps my computer handles it differently(used your code but without textures)

Part of solving the problem is actually noticing that the problem is there in the first place

Basic brain
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location:
Posted: 14th Jan 2005 22:39
Maybe I should install the upgrades...I'll post again when I've done that.
Spaceman Spiff
20
Years of Service
User Offline
Joined: 27th Jan 2004
Location: Smacking my head on your keyboard.
Posted: 15th Jan 2005 09:06
Just as a note I've noticed that in the "My first FPS game" tutorial that comes with Pro if you look up and tha push to of the arrow keys you will start to fly it really weired. Sorry just thought that was interesting.

I've bein driving since the age of three; if you don't belive me ask my parents, you can find them at the county hospital for the mentally imbalanced.
Basic brain
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location:
Posted: 17th Jan 2005 20:47
Updates installed over the weekend - and now it works. I am officially a happy chappy - thanks Dodo!!!!

p.s. I changed it to
YPos#=get ground height(1,pX#,pZ#)+80
as +10 put the camera at hobbit knee height!
I also re-visited the fps tutorial for help with a crosshair...

Login to post a reply

Server time is: 2024-11-27 19:49:48
Your offset time is: 2024-11-27 19:49:48