Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tan = math.tan
- function draw.Parallelogram(x,y,w,h,angle,rot)
- -- sin Y
- -- cos X
- local length = 1/(tan(math.rad(angle))/h)
- local dots = {
- { x = (x+length) , y = y}, -- A
- { x = (x+length+w), y = y}, -- B
- { x = (x+w), y = (y + h)}, -- C
- { x = x, y = (y+h)} -- D
- }
- if rot != nil then
- local rotate_rad = math.rad(rot)
- local sine = math.sin(rotate_rad)
- local cosine = math.cos(rotate_rad)
- for k,v in pairs(dots) do -- apply rotation
- local stored = { x = v.x - x - w/2, y = v.y - y - h/2} -- centre?
- v.x = stored.x * cosine - stored.y * sine + x + w/2
- v.y = stored.y * cosine + stored.x * sine + y + h/2
- end
- surface.DrawPoly( dots )
- return
- end
- surface.DrawPoly( dots )
- end
- hook.Add( "HUDPaint", "PolygonTest", function()
- draw.NoTexture()
- --////////DRAW HOLDER/////
- surface.SetDrawColor( 0, 0, 0, 255 )
- draw.Parallelogram( 250, 250, 200, 15, 45 )
- surface.SetDrawColor( 255, 0, 0, 255 )
- --///// END DRAW HOLDER////////
- --/// DRAW HBAR ////
- local BarQuantity = LocalPlayer():GetMaxHealth()/100
- local bars = math.ceil(LocalPlayer():Health()/BarQuantity)
- for I = 1,bars do
- draw.Parallelogram( 250 + 2*I, 250, 2, 15, 45 ) -- 400 ( len
- end
- --// END DRAWHBAR //
- --// DRAW HOLDER ( ABAR) //
- surface.SetDrawColor( 0, 0, 0, 255 )
- draw.Parallelogram( 235, 265, 200, 15, 45 )
- surface.SetDrawColor( 0, 0, 255, 255 )
- --// END DRAW HOLDER //
- -- // DRAW ABAR
- for I = 1,math.ceil(LocalPlayer():Armor()) do
- draw.Parallelogram( 235 + 2*I, 265, 2, 15, 45 )
- end
- --// END DRAW ABAR
- surface.SetDrawColor( 0, 255, 0, 255 ) -- avatar
- draw.Parallelogram( 206, 225, 50, 50, 90, 45) -- avatar
- surface.SetDrawColor( 0, 0, 0, 255 )
- draw.Parallelogram( 250, 235, 200, 15, -45 )
- draw.Parallelogram( 250, 220, 200, 15, -45 )
- end )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement