kay i found the distance just to have a bigg prob i made this code as a sort of Zelda l targeting system but when it is actived the player moves across to the target and stays horizontal
the only other bit of code that affects this is the lockangleY# which is the angle of the target which point towards you because its running after you any idea on what the problem is
point object 1,mX#,mY#,mZ#
If Upkey()=1
move object 1,5
Endif
If Leftkey()=1 then lockAngleY#=Wrapvalue(lockAngleY#-5)
If Rightkey()=1 then lockAngleY#=Wrapvalue(lockAngleY#+5)
if spacekey()=1 and baddy#>0
lock#=lock#+1
if lock#=2 then lock#=0
endif
pX# = Object position x(1)
pZ# = Object position z(1)
mX# = Object position x(56)
mZ# = Object position z(56)
difX#=mX#-pX#
difZ#=mZ#-pZ#
diffX#=difX#*difX#
diffZ#=difZ#*difZ#
differ#=diffZ#+diffX#
distance#=sqrt(diff#)
Z# = Newzvalue(mZ#,lockangleY#,distance)
X# = Newxvalue(mX#,lockangleY#,distance)
Y# = Get Ground Height(1,nX#,nZ#)
position object 1,X#,Y#+10,Z#
CameraZ# = Newzvalue(Z#,AngleY#-180,20)
CameraX# = Newxvalue(X#,AngleY#-180,20)
CameraY# = Get Ground Height(1,cameraX#,cameraZ#)
if CameraY#<30 then CameraY#=30.1
Position camera CameraX#,CameraY#+17,CameraZ#
Point camera X#,Y#+12,Z#
thx for any help i get
woody
Newbie Now; Expert Later
Current project:The Sorus
