Pretty straightforward:
Graphics3D 800, 600
cam = CreateCamera()
RotateEntity cam, 90, 0, 0
MoveEntity cam, 0, 0, -15
CreateLight()
Dim WayPoint(10, 1)
CurrentWayPoint = 0
;load up array
For iter = 1 To 10
Read WayPoint(iter, 0)
Read WayPoint(iter, 1)
;the following code is included just to display the waypoints
wp = CreateCube()
PositionEntity wp, WayPoint(iter, 0), 0, WayPoint(iter, 1)
ScaleEntity wp, .1, .1, .1
EntityColor wp, (20*iter+50), 0, 0
;the above code is for test purposes only
Next
;create game objects
Copter = CreateCone()
RotateMesh Copter, 90, 0, 0
;gameloop
While Not KeyHit(1)
xvector# = WayPoint(CurrentWayPoint, 0) - EntityX(Copter)
zvector# = WayPoint(CurrentWayPoint, 1) - EntityZ(Copter)
AlignToVector Copter, xvector, 0, zvector, 3, .03
MoveEntity Copter, 0, 0, .05
If Abs(EntityX(Copter)-WayPoint(CurrentWayPoint, 0)) < .5 And Abs(EntityZ(Copter)-WayPoint(CurrentWayPoint, 1)) < .5
CurrentWayPoint = CurrentWayPoint + 1
If CurrentWayPoint = 11 Then End
EndIf
RenderWorld
Flip
Wend
;data
Data 5, 5
Data 2, -3
Data -4, -7
Data -1, 0
Data -9, 1
Data 2, 3
Data -2, 4
Data 8, -8
Data 9, 3
Data 10, 10
|