Posted: 7th Nov 2003 6:17
Here is a strange way I made to move objects. Could be used in a game where you control multiple units.

Press M to go into move mode.
In move mode use arrows to move the 2nd cube. Press space to exit move mode and have the 1t cube move to the 2nd cube.

+ Code Snippet
sync on
autocam off

make matrix 1,1000,1000,10,10

make object cube 1,10
pitch camera down 90
position camera 0,150,0

m = 0

do

if inkey$()="m" and m = 0
make object cube 2,10
position object 2,object position x(1),object position y(1),object position z(1)
m = 1
endif

if m = 1
if leftkey()=1 then turn object left 2,5
if rightkey()=1 then turn object right 2,5
if upkey()=1 then move object 2,5
if downkey()=1 then move object 2,-5
if spacekey()=1 then m = 2
endif

if m = 2
point object 1,object position x(2),object position y(2),object position z(2)
move object 1,3
if object collision(1,2)=1 
delete object 2
m = 0
endif
endif

if m = 1
position camera object position x(2),150,object position z(2)
else
position camera object position x(1),150,object position z(1)
endif

sync
loop
Posted: 7th Nov 2003 7:15
Does anyone know how to modify this modified version to make the object eventually point at the movement cube?

+ Code Snippet
sync on
autocam off

make matrix 1,1000,1000,10,10

make object cube 1,10
pitch camera down 90
position camera 0,150,0

m = 0

do

ay1# = object angle y(1)
if m > 0 then ay2# = object angle y(2)

if inkey$()="m" and m = 0
make object cube 2,10
position object 2,object position x(1),object position y(1),object position z(1)
m = 1
endif

if m = 1
if leftkey()=1 then turn object left 2,5
if rightkey()=1 then turn object right 2,5
if upkey()=1 then move object 2,5
if downkey()=1 then move object 2,-5
if spacekey()=1 then m = 2
endif

if m = 2
if ay1# > ay2# then ay1# = ay1# - 1
if ay1# < ay2# then ay1# = ay1# + 1
move object 1,3
if object collision(1,2)=1 
delete object 2
m = 0
endif
endif

if m = 1
position camera object position x(2),150,object position z(2)
else
position camera object position x(1),150,object position z(1)
endif

yrotate object 1,ay1#

sync
loop
Posted: 8th Nov 2003 4:55
since this is turning more into a question I ammoving it to DArk Basic discussion.
Posted: 11th Nov 2003 21:36
Use this snippet from Kenmo to find the angle between two objects. Then you can point and move the object to the another.

+ Code Snippet
cls 
backdrop on 
autocam off
make object cube 1,1 
make object cube 2,1
position object 2,70,0,70
point object 1,object position x(2),object position y(2),object position z(2)
point#=object angle y(1)
atan#=wrapvalue(atanfull(object position x(2)-object position x(1),object position z(2)-object position z(1)))
backdrop off 
cls 
print point# 
print atan# 

Posted: 13th Nov 2003 3:04
Wow, searched for my name and look! Someone actually used one of my snippets... about 7 months ago...

Wow Im bored!
Posted: 15th Nov 2003 19:36
Ok, thanks.