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 Professional Discussion / help moving car with letter keys

Author
Message
Stormbringer
22
Years of Service
User Offline
Joined: 1st Oct 2003
Location:
Posted: 2nd Oct 2003 02:48
Would somebody please explain how to move object with the letter keys on the keyboard. I've used the arrow keys for moving my editting camera and would like to keep it this way for now, it helps me see quickly where i place my objects on the matrix.

anyways, I'ved looked at variuos codes for ideas and just can't seem to pull it off. help would be appriciated
thanx
Stormbringer
22
Years of Service
User Offline
Joined: 1st Oct 2003
Location:
Posted: 2nd Oct 2003 03:02
heck a simple line showing how to move an object forward with any key say "w" for example would be sufficiant.
thanx again
Symon
22
Years of Service
User Offline
Joined: 29th Aug 2003
Location:
Posted: 2nd Oct 2003 03:09
erm
if inkey$()="a" then move object 1,10
Stormbringer
22
Years of Service
User Offline
Joined: 1st Oct 2003
Location:
Posted: 2nd Oct 2003 03:26
tried this but nothing happens
do i need a loop or to assign variables to key$
MicroMan
22
Years of Service
User Offline
Joined: 19th Aug 2003
Location: Stockholm, Sweden
Posted: 2nd Oct 2003 03:40
You can use the scancodes for that. For instance, like the following snippet...



-----
They SAID that given enough time a million monkeys with typewriters could recreate the collected works of William Shakespeare... Internet sure proved them wrong.
-----
Stormbringer
22
Years of Service
User Offline
Joined: 1st Oct 2003
Location:
Posted: 2nd Oct 2003 03:43
basically typing
if inkey$()"key letter"then move object obj.#, dist
does nothing
Stormbringer
22
Years of Service
User Offline
Joined: 1st Oct 2003
Location:
Posted: 2nd Oct 2003 03:52
tanks microman but this does nothing either
im using pro by the way
Stormbringer
22
Years of Service
User Offline
Joined: 1st Oct 2003
Location:
Posted: 2nd Oct 2003 03:56
i have at this point objects placed in the arena with 2 cars now i simply would like to be able to move and control one of the cars at this poinbt
Owl
22
Years of Service
User Offline
Joined: 28th Sep 2003
Location: Imatra, Finland
Posted: 2nd Oct 2003 03:59
Could you post the code snippet where you use the arrow keys for moving, so we could help you better... ? ...and no, not the whole source, just the part where the moving stuff occurs.
Stormbringer
22
Years of Service
User Offline
Joined: 1st Oct 2003
Location:
Posted: 2nd Oct 2003 04:05
rem move edit camera
repeat
rotate camera camera angle x(0)+(mousemovey()/2.0),camera angle y(0)+(mousemovex()/2.0),0
cx#=camera angle x(0) :cy#=camera angle y(0)
if upkey()=1 then xrotate camera 0,0 : move camera 0,0.2 : xrotate camera 0,cx#
if downkey()=1 then xrotate camera 0,0 : move camera 0,-0.2 : xrotate camera 0,cx#
if leftkey()=1 then yrotate camera 0,cy#-90 : move camera 0.2 : yrotate camera 0,cy#
if rightkey()=1 then yrotate camera 0,cy#90 : move camera 0.2 : yrotate camera 0,cy#
if wrapvalue(camera angle x(0))>40 and wrapvalue(camera angle x(0))<180 then xrotate camera 0,40
if wrapvalue(camera angle x(0))>180 and wrapvalue(camera angle x(0))<280 then xrotate camera 0,280


this i used from them manual from controlling the player but put it on my edit camera from the get go so i could see where i was placing objects
Stormbringer
22
Years of Service
User Offline
Joined: 1st Oct 2003
Location:
Posted: 2nd Oct 2003 04:07
as far as moving the vehicle im at ground zero
Stormbringer
22
Years of Service
User Offline
Joined: 1st Oct 2003
Location:
Posted: 2nd Oct 2003 04:15
this is my first program what im trying to do is create a vehicle combat game in pro. I felt that with it having a simple arena with very little animation it would be a good place to start. I've read the book 600+ pages but all the exaples are classic with the example game having lots of sever crap that at this point i don't care to deal with.
ReD_eYe
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 2nd Oct 2003 11:05
what object number is your vehicle? just use
if keystate(17)=1 then move object <vehicle number here>,10
put that in your main loop


richardneail
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 2nd Oct 2003 12:32
Ok here you go this is a working bit of code.



Just copy this you should be able to figure out how to include it in your own program.

Rich

You might never win but if you give in will you ever know ??????

Login to post a reply

Server time is: 2026-07-25 17:05:40
Your offset time is: 2026-07-25 17:05:40