Dim targetx As Float
Dim targety As Float
Dim obj2x As Float
Dim obj2y As Float
DrawToWorld ON
FrameLimit 40
obj1=LoadObject("Media\guy.bmp")
obj2=LoadObject("Media\guy.bmp")
AddText "The code updates every 3 seconds..."
Repeat
'Perform this every 3 seconds
If TIMER()>moment+3000 Then
targetx=Rnd( -180,180)
targety=Rnd( -130,130)
moment=TIMER()
EndIf
'curve location, round it against the target
obj2x=CurveValue(targetx,obj2x,20.0)
obj2y=CurveValue(targety,obj2y,20.0)
PositionObject obj2,obj2x,obj2y
Text 0,30,"Distance: "+Distance2(obj1,obj2)
DrawScreen
Until EscapeKey()
|
|