Difference between revisions of "Script - Velocity Indicator"
From FreeSpace Wiki
(new page) |
(No difference)
|
Revision as of 07:53, 7 July 2006
Function
Creates an additional reticle that points towards the real movement direction and also prints the actual velocity (lenght of the velocity vector to the screen)
Table Entry
#Global Hooks
$GameInit:
[
drawvelret = function(x, y)
gr.drawGradientLine(x+20,y+20,x+5,y+5)
gr.drawGradientLine(x-20,y+20,x-5,y+5)
gr.drawGradientLine(x+20,y-20,x+5,y-5)
gr.drawGradientLine(x-20,y-20,x-5,y-5)
gr.drawGradientLine(x,y,x+6,y+6)
gr.drawGradientLine(x,y,x+6,y-6)
gr.drawGradientLine(x,y,x-6,y+6)
gr.drawGradientLine(x,y,x-6,y-6)
end
]
$HUD:
[
position = plr.Position
velocity = plr.Velocity
vlenght = velocity:getMagnitude()
vvector = position + (velocity/(vlenght/2000))
gr.setColor(230,230,100,255)
if vvector:getScreenCoords() ~= false and vlenght > 5 then
X, Y = vvector:getScreenCoords()
drawvelret(X, Y)
end
gr.drawString("True Velocity:",435,750)
gr.drawString(math.floor(vlenght),575,750)
]
#End
Notes
Current version is ment for 1024 x 768 resolution. Final position of the True Velocity: xxx gauge is yet to be determined.