ScriptName CirclingAroundThePlayerScript
short constantsset ; did we set the constants?
float rspeed ; in degrees/s
float hdist ; horizontal distance from the player
float rpos ; position on the circle
float mod_x ; positions relative to the player
float mod_y
float mod_z
float org_x ; position of the player
float org_y
float org_z
float ang_x ; rotation of the dagger
float ang_y
float ang_z
Begin GameMode
; setting up constants
if constantsset == 0
set rspeed to 10 ; constant radial speed
set mod_z to 110 ; constant height
set hdist to 50 ; constant distance
set constantsset to 1 ; done setting up the constants
endif
; updating the position on the circle (rpos)
set rpos to rpos + ( rspeed * getSecondsPassed )
if rpos > 360
set rpos to rpos - 360
endif
; setting the mods, via the SinCosTan function
set f.fin1 to rpos
setStage f 15 ; SinCosTan(rpos) function call
set mod_x to f.fout * hdist ; sin(rpos) * hdist
set mod_y to f.fout2 * hdist ; cos(rpos) * hdist
; getting the player's position
set org_x to player.getPos X
set org_y to player.getPos Y
set org_z to player.getPos Z
; setting my own position
set org_x to org_x + mod_x
setPos X, org_x
set org_y to org_y + mod_y
setPos Y, org_y
set org_z to org_z + mod_z
setPos Z, org_z
; setting my own z-Angle
set ang_z to rpos + 90
setAngle z ang_z
; setting my own y-rotation
;set ang_y to ang_y + (rspeed * getSecondsPassed)
rotate y 90
; setting my own x-rotation
;set ang_x to ang_x + (rspeed * getSecondsPassed)
;rotate x ang_x
End