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 / Movement code trouble

Author
Message
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 20th Mar 2007 15:26
Hi everybody zombie again. I'm having some trouble with this movement code, i cannot get my sphere to turn left or right and the only thing i haven't tried yet is keystate. I was wondering if anyone could help me. Please, it would be a big help.



"You can't expect to wield supreme executive power just because some watery tart throws a sword at you..."
zeddex2
18
Years of Service
User Offline
Joined: 4th Mar 2007
Location:
Posted: 20th Mar 2007 15:47
Ok first, the keystate will be more usefull than up or down key becose if you want your player move and turn at the same time, you need to make mouvement with keystat().

Ok your mouvement code sure don t work for turning left or right
that what your code mean,
if upkey = 1 then move foward
if downkey = 1 then move backyard
if leftkey = 1 then move backyard
if rightkey = 1 then move foward

what you what is if left or right key = 1 then rotate your object

like this

if leftkey() = 1 then yrotate object 1, wrapvalue(object angle y(1) +1)
if leftkey() = 1 then yrotate object 1, wrapvalue(object angle y(1) -1)

with that code, your object 1 will rotate on himself

P.S. if you use set camera to follow in the angle of the command, don t forget to put the object angley(1)

If you can, I can!
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 20th Mar 2007 16:27
zeddx2- thanks for you help, i had another question.

For a box, could i use my original movement code to make it go left, right, up,down?

thanks for the code

zombie

"You can't expect to wield supreme executive power just because some watery tart throws a sword at you..."
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 20th Mar 2007 16:31
sorry for doubleposting, but I don't quite get the set camera angle. Could you post an example, i'm a big visual learner, you don't have to, i could figure it out eventually, but i'd appreciate it. Thank you for your help.

zombie

"You can't expect to wield supreme executive power just because some watery tart throws a sword at you..."
zeddex2
18
Years of Service
User Offline
Joined: 4th Mar 2007
Location:
Posted: 20th Mar 2007 17:09
question 1: Yes you can, just change the object number

Question 2:


so code:
X# = object position X(1)
Y# = object position Y(1)
Z# = object position Z(1)
Aoy# = object angle y(1)

set camera to follow X#, Y#, Z#, Aoy#, distance, heigh, smooth, collision

so the camera point all the time a the back of object 1

If you can, I can!
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 20th Mar 2007 20:52
Thank you sir.

zombie out

"You can't expect to wield supreme executive power just because some watery tart throws a sword at you..."
Asternus
20
Years of Service
User Offline
Joined: 11th Aug 2004
Location: N.C. U.S.A
Posted: 24th Mar 2007 07:06
Hmm,Thank you zeddex2.
So you can set an object's X,Y,Z,and Angle as a variable.Can you set an object's number as a variable?
Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 24th Mar 2007 20:07
yes
ex.:

mycar=1

position object mycar,x#,y#,z#
yrotate object mycar,angley#
etc...
Johnathon
18
Years of Service
User Offline
Joined: 20th Feb 2007
Location: South Park
Posted: 1st Apr 2007 14:16
Johnathon
18
Years of Service
User Offline
Joined: 20th Feb 2007
Location: South Park
Posted: 1st Apr 2007 14:18
if you want the camera to follow the object then put this in the do,loop

Login to post a reply

Server time is: 2025-05-29 09:01:52
Your offset time is: 2025-05-29 09:01:52