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 / Move Object.. need help

Author
Message
AndyUK
23
Years of Service
User Offline
Joined: 2nd Apr 2003
Location: United Kingdom
Posted: 5th Apr 2003 03:09 Edited at: 5th Apr 2003 03:11
god i feel so stupid.. a command with only 2 parameters and i cant get it to do what i want it to do. my understanding of this command is to move an object in its current direction at the speed i desire..

if upkey()=1
move object 1,0.1
endif


when i put this in my code.. sure it moves but it moves 0.1 world units and sits there untill i let go of the up key, then it returns to its original position. im probably missunderstanding the usage of this command.

someone please correct me

thanx

| P4 2.4(533) | 512DDR(333) | GF4Ti4200 64MB | WinXP Home Sp1 | Cup of CoffeE |
KuRi
23
Years of Service
User Offline
Joined: 8th Feb 2003
Location:
Posted: 5th Apr 2003 03:25
Please post the rest of your code, it could help...

AndyUK
23
Years of Service
User Offline
Joined: 2nd Apr 2003
Location: United Kingdom
Posted: 5th Apr 2003 03:32 Edited at: 5th Apr 2003 03:35
set display mode 1024,768,32
sync on
backdrop off
hide mouse
set text size 15
load bsp "level.pk3","q3dm7.bsp"
set camera range 0.1,1000
autocam off
position camera 65,3,-40
make object box 1,1,1,1
do
text 0,0,"Fps"
text 0,20,"X Pos"
text 0,40,"Y Pos"
text 0,60,"Z Pos"
text 50,0,str$(Screen Fps())
text 50,20,str$(camera position x())
text 50,40,str$(camera position y())
text 50,60,str$(camera position z())
position object 1,60,3,-40
rotate camera camera angle x()+(mousemovey()/5.0),camera angle y()+(mousemovex()/5.0),0
if upkey()=1
move object 1,0.1
endif
if downkey()=1
move object 1,-0.1
endif
sync
loop


you can get the bsp from here [href] http://www.darkbasicpro.com/apollo/view.php?t=8233&b=1

i had code in there to move the camera which worked fine..

| P4 2.4(533) | 512DDR(333) | GF4Ti4200 64MB | WinXP Home Sp1 | Cup of CoffeE |
Easily Confused
23
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 5th Apr 2003 04:19
Position Object 1,60,3,-40 is your problem, you're placing your object to an absolute position from inside your main loop, so when you try to move it, it will just return to 60,3,-40

Here, I've placed it after Make Object Box 1,1,1,1



Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
AndyUK
23
Years of Service
User Offline
Joined: 2nd Apr 2003
Location: United Kingdom
Posted: 5th Apr 2003 04:27 Edited at: 5th Apr 2003 04:30
LOL!! hehe omg! thanks so much.. how stupid do i feel... oh well. I have an excuse, its 2.30am here and im out of cofffee.. thanks

| P4 2.4(533) | 512DDR(333) | GF4Ti4200 64MB | WinXP Home Sp1 | Cup of CoffeE |

Login to post a reply

Server time is: 2026-07-11 10:26:12
Your offset time is: 2026-07-11 10:26:12