Few things to ask before getting started.
Is it possible to use a vmt or png for the HUD and implement the health and armor statuses in it? (of course setting correct placement)
(health and armor statuses = Health:100/100 and armor 100/100)
How to draw health and make it lose health for amount of damage recieved?
How to draw hexagons?
Steam Avatar in hexagon shape?
Here's the png we will be using:
[T]http://i.imgur.com/Beco8XA.png[/T]
I've seen this done before although I am not sure how. Nice design though :)
[QUOTE=Aeternal;44514009]Few things to ask before getting started.
Is it possible to use a vmt or png for the HUD and implement the health and armor statuses in it? (of course setting correct placement)
(health and armor statuses = Health:100/100 and armor 100/100)
How to draw health and make it lose health for amount of damage recieved?
How to draw hexagons?
Steam Avatar in hexagon shape?
Here's the png we will be using:
[T]http://i.imgur.com/Beco8XA.png[/T][/QUOTE]
Stencils and draw poly funcs
That looks sick as hell.
Anyway, for drawing hexagons or any polygon, [URL="http://wiki.garrysmod.com/page/surface/DrawPoly"]surface.DrawPoly[/URL] its hell to use but its the only thing like it. It also takes a table of x,y coords
for the "Health 100/100" it would be "ply:Health().." / "..ply:GetMaxHealth()"
for the health bar you would just set the length to be ply:Health() and clamp it
The png/material on the hud is possible ill see if i can find an example code somewhere on my pc. But its basically [URL="http://wiki.garrysmod.com/page/surface/DrawTexturedRect"]surface.drawtexturedrect[/URL], [URL="http://wiki.garrysmod.com/page/surface/SetMaterial"]surface.setmaterial[/URL], and [URL="http://wiki.garrysmod.com/page/surface/SetDrawColor"]surface.setdrawcolor[/URL]
If you can use a rectangle and a texture for things like the hexagons, it would be preferred over surface.DrawPoly to save performance.
[QUOTE=samm5506;44514785]If you can use a rectangle and a texture for things like the hexagons, it would be preferred over surface.DrawPoly to save performance.[/QUOTE]
Thats true you could just use hexagon in a square with a transparent bg
Here's a tutorial on using DrawPoly: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/poly/creating_shapes_using_poly.lua.html[/url]
which generates: [IMG]http://cloud-2.steampowered.com/ugc/633043075520065770/3DD7A638C50EA0774F965C20CBC42E2395E04D6F/[/IMG]
Additionally I made a poly "class" which contain functions, plus draw functions to create arrows, rects, circles ( and adding more as I go ). I'm planning on releasing it with my base developer-ready game-mode with massive amounts of helper-functions.
When the class is done, it'll allow you to choose the 0,0 position of the element ( center, bottom-left, bottom-right, top-left, top-right ) using enumerations to help simplify the math when using them.
One thing I do need to change on that tutorial ( which I'm doing now, so refresh if it's still like it is ) is to make the poly outside the hook so it doesn't need to regenerate the table each time ( except when resolution changes )
Sorry, you need to Log In to post a reply to this thread.