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 / I need help

Author
Message
MrMe
23
Years of Service
User Offline
Joined: 24th Jun 2003
Location:
Posted: 24th Jun 2003 12:43
I am new to DB. Ive been programming for 3 years though in VB. I was in the process of learning DX when i found DB. Now i want to go completely to DB for any game i make. For one of my first programs i was going to make a program with a matrix that you walk on following a 3d model and avoiding different walls. I was going to do this to learn colllision detection and all that other good stuff. Well i ran into a little problem. When i spin the camera around the matrix tilts and i can not figure out why. Plus the camera always seems to point down. If anyone could look at the code and tell me whats up it would be much appreciated. The code is just matrix and camera code not the full test project. Thanks
MrMe
23
Years of Service
User Offline
Joined: 24th Jun 2003
Location:
Posted: 24th Jun 2003 12:56
Also what is the inkey() function used for. I have seen it a few times but have never understood what it it does.
Thanks

Mentor
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 24th Jun 2003 13:55 Edited at: 24th Jun 2003 13:57
make matrix 1, 100, 100, 100, 100

position camera 50, 3, 50

do
set cursor 0, 0

if UPKEY() = 1 then move camera 1
if DOWNKEY() = 1 then move camera -1
if leftkey() = 1 then turn camera left 1
if rightkey() = 1 then turn camera right 1

loop

by default the camera starts off looking down slightly at the 0,0,0 position, to stop yourself submerging under the ground as you move forwards, set the camera level like this

autocam off:rem stops the camera pointing at anything you may create on the level
position camera 50,3,50
point camera 51,3,51:rem this makes the camera point level to the z plain by pointing one world unit away at the same height

and inkey$() returns the string value of the keys on the keyboard, so inkey$() returns "d" when you press the "d" key, or " " when you press the space key, you have to use the other commands to read keys like F1 or home that don`t have visible characters (like upkey for example), cheers.

Mentor.

MrMe
23
Years of Service
User Offline
Joined: 24th Jun 2003
Location:
Posted: 24th Jun 2003 18:46
Thanks alot. Everything worked out fine.

Mattman
23
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 24th Jun 2003 19:09
hey mrme, welcome to db and i have a question for you. where did you get your forum name? is it from the they might be giants song? they r a great band!

---Mattman
"Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done." Andy Rooney
Bloodshot
23
Years of Service
User Offline
Joined: 7th Apr 2003
Location: United Kingdom
Posted: 24th Jun 2003 22:12
Maybe he's just MrMiniMe's BIG brother!
Bloodshot
23
Years of Service
User Offline
Joined: 7th Apr 2003
Location: United Kingdom
Posted: 24th Jun 2003 22:15 Edited at: 24th Jun 2003 22:17
A Mike Myers fan, perhaps?

(Ooops, I'm seeing double! I'm pretty sure there was enough room for this line to fit in my other post..Doh!)

Login to post a reply

Server time is: 2026-07-06 01:18:33
Your offset time is: 2026-07-06 01:18:33