i have some code that seems to have parkinsons disease.. can anyone point out what maybe going wrong here..
Global gameFPS = 50
Global follow_angle=0,follow_radius#=20.0,follow_high#=6.0
;timer
Global gametimer00=MilliSecs()
Global framePeriod = 1000 / gameFPS
Global frameTime = MilliSecs () - framePeriod
Global tweening=True
Graphics3D 640,480,0,2
Global man=CreateCube()
Global followpivot=CreatePivot()
Global manpivot=CreatePivot()
Global cam=CreateCamera()
test_level()
End
Function test_level()
;LOOP
Repeat
Repeat
frameElapsed = MilliSecs () - frameTime
Until frameElapsed
frameTicks = frameElapsed / framePeriod
frameTween# = Float (frameElapsed Mod framePeriod) / Float (framePeriod)
For frameLimit = 1 To frameTicks
If frameLimit = frameTicks Then CaptureWorld
frameTime = frameTime + framePeriod
;DRAW 3D
place_follow_cam()
UpdateWorld
Next
;render the world with instant or tweening (smooth)
If tweening=True
RenderWorld frameTween
Else
RenderWorld
EndIf
;DRAW 2D & WINDOWS
Text 0,0,"F1/F2 =spin around cube, F3/F4 =zoom in/out, F5/F6 = adjust height, F7 =Reset"
Flip
Until KeyHit (1)
End Function
Function place_follow_cam()
f_keys()
tx=Float(EntityX(man)+Cos(follow_angle+90)*follow_radius#)
ty=Float(EntityZ(man)+Sin(follow_angle+90)*follow_radius#)
th=(h_spot*8)+follow_high#
PositionEntity followpivot,tx,th,ty
PositionEntity manpivot,EntityX(man),EntityY(man)+6,EntityZ(man)
PositionEntity cam,EntityX(followpivot),EntityY(followpivot),EntityZ(followpivot)
PointEntity cam,manpivot
End Function
|