checkpoint arrows

This commit is contained in:
YuRaNnNzZZ 2023-07-21 19:57:49 +03:00
parent 3e8139860e
commit 6176b706a1
No known key found for this signature in database
GPG key ID: 5F71738C85A6006D
3 changed files with 28 additions and 0 deletions

View file

@ -0,0 +1,7 @@
"UnlitGeneric"
{
$basetexture "medge/timetrial/arrow_02"
$translucent "1"
$vertexcolor "1"
$vertexalpha "1"
}

View file

@ -77,6 +77,10 @@ local red = Color(255, 0, 0, 200)
local circlepos = Vector() local circlepos = Vector()
local circleup = Vector(0, 0, 10000) local circleup = Vector(0, 0, 10000)
local checkheight = Vector(0, 0, 64) -- eyepos diff
local arrow = Material("medge/timetrial/checkpoint_arrow")
local asize = 32
function ENT:DrawTranslucent() function ENT:DrawTranslucent()
self:SetRenderBounds(minb, maxb) self:SetRenderBounds(minb, maxb)
@ -96,6 +100,23 @@ function ENT:DrawTranslucent()
render.DrawBeam(newpos, newpos + circleup, 8, 0, 1, red, true) render.DrawBeam(newpos, newpos + circleup, 8, 0, 1, red, true)
end end
local nextCP = Checkpoints[self:GetCPNum() + 1] or self
local selfpos = self:GetPos() + checkheight
local fwAng = (nextCP:GetPos() - selfpos):GetNormalized():Angle()
for i = 0, 1, 0.1 do
local prog = (SysTime() * .25) % 0.1 + i
red.a = 255 * (prog > 0.5 and 0.5 - prog or prog) * 2
local size = asize * (1 - prog)
local pos = selfpos - fwAng:Forward() * asize + fwAng:Forward() * (asize * 2) * prog
render.SetMaterial(arrow)
render.DrawBeam(pos - fwAng:Forward() * size * .5, pos + fwAng:Forward() * size * .5, size, 1, 0, red)
end
-- local bmin, bmax = self:GetRenderBounds() -- local bmin, bmax = self:GetRenderBounds()
-- render.DrawWireframeBox(self:GetPos(), angle_zero, bmin, bmax) -- render.DrawWireframeBox(self:GetPos(), angle_zero, bmin, bmax)
self.offset = self.offset + 0.00075 self.offset = self.offset + 0.00075