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 / move object towards player?

Author
Message
mike5424
15
Years of Service
User Offline
Joined: 30th Mar 2009
Location:
Posted: 30th Apr 2009 20:40
i would like to know how to make it so when the player can see an object it starts moving towards them for example:

when i see the rocket it starts moving towards me

i use the "if object visible" code but when i try using somthing like "move object 5,.4" it moves in one direction how would i make it move towards me?

also how do i instantly rotate an object? when i try it takes around 10-20 seconds to rotate

www.madninjas.co.nr we are mad and we are ninjas
Izzy545
20
Years of Service
User Offline
Joined: 18th Feb 2004
Location:
Posted: 30th Apr 2009 21:10
You can point it at the players position before you tell it to move, for example, assume you're storing your players X, Y, and Z values in X#, Y#, and Z# variables, you can point an object to them like this:

point object 1, X#, Y#, Z#

Just replace the object number 1 with the object you want to move to the player.

After that, when you tell it to "move object 5,.4" it will move towards the player.

To instantly rotate an object, just use the regular rotation commands and set the angle to be the end rotation angle you want.

Say you wanted to rotate an object to 90 degrees on the X axis, you'd say:

xrotate object 1, 90

Or if you want to rotate it to angles on the X, Y, and Z axis:

rotate object 1, 270, 0, 90

Hope that helped

mike5424
15
Years of Service
User Offline
Joined: 30th Mar 2009
Location:
Posted: 30th Apr 2009 21:45
thx, i am about to test it now thank you

www.madninjas.co.nr we are mad and we are ninjas
bobbel
15
Years of Service
User Offline
Joined: 5th Jan 2009
Location: In my DBPro case xD
Posted: 2nd May 2009 10:39
i don;t know if you know this, but if you wanna do it when the player sees the object, you can use "Object in screen" command, but this doesn't work for walls and stuff

(\__/)
(O.o )
(> < ) This is Bunny. Copy Bunny into your signature to help him on his way to world domination!
pc nerd
User Banned
Posted: 4th May 2009 01:42
This is the best way, for me anyhow, just make an invisible box, use it as a trigger, so when the player you, are in the box then the guy follows you, when your not in the box he will not follow you.

dweeb
bobbel
15
Years of Service
User Offline
Joined: 5th Jan 2009
Location: In my DBPro case xD
Posted: 4th May 2009 08:28
never thought of it like that, thats the best way i think

(\__/)
(O.o )
(> < ) This is Bunny. Copy Bunny into your signature to help him on his way to world domination!
feiting shadow
18
Years of Service
User Offline
Joined: 12th Sep 2006
Location:
Posted: 4th May 2009 09:23
set camera position (object position x(obj), object position y(obj), object position z(obj) )

point camera at object( forgot variables for this)

set object to camera orientation(obj)
then reset camera to player (old positions)....

or something like that... it's a neat little trick that's only possible b/c of DB's high level coding... also, it'll use a TON of resources compared to the above, so only use it in small games. I've done it... (not in anything I've released tho)

Signed
------

Login to post a reply

Server time is: 2024-09-28 06:23:41
Your offset time is: 2024-09-28 06:23:41