Poly problems.

Hello, I’m trying to draw a poly to represent a user’s HP. But something very odd is happening.



	Phealth[2]["x"] = 95+(LocalPlayer():Health()*2.25)
	Phealth[3]["x"] = 85+(LocalPlayer():Health()*2.25)

	surface.SetDrawColor( 0, 0, 0, 255 )
	surface.DrawPoly( Bhealth )
	surface.SetDrawColor( 255, 0, 0, 255 )
	surface.DrawPoly( Phealth )
	
	--Outline around models and steampic
	draw.RoundedBoxEx(4, 2, ScrH()- 130, 80, 128, Color(5, 5, 5, 200), 1, 1, 1, 0)
	draw.RoundedBoxEx(2, 4, ScrH()- 127, 75, 122, Color(0,100,100,125), 1, 1, 1, 0)
	draw.RoundedBox(0, 8, ScrH()- 62, 56, 56, Color(5, 5, 5, 100))
	draw.RoundedBox(0, 8, ScrH()- 124, 56, 56, Color(5, 5, 5, 100))
	--Health outline
	draw.RoundedBoxEx(4, 82, ScrH()- 50, 80, 48, Color(5, 5, 5, 200), 1, 1, 1, 0)


This code works, the poly’s draw. But the box is on top of the hp, so no good. When I change it to this :



	Phealth[2]["x"] = 95+(LocalPlayer():Health()*2.25)
	Phealth[3]["x"] = 85+(LocalPlayer():Health()*2.25)

	--Health outline
	draw.RoundedBoxEx(4, 82, ScrH()- 50, 80, 48, Color(5, 5, 5, 200), 1, 1, 1, 0)
	
	surface.SetDrawColor( 0, 0, 0, 255 )
	surface.DrawPoly( Bhealth )
	surface.SetDrawColor( 255, 0, 0, 255 )
	surface.DrawPoly( Phealth )

	--Outline around models and steampic
	draw.RoundedBoxEx(4, 2, ScrH()- 130, 80, 128, Color(5, 5, 5, 200), 1, 1, 1, 0)
	draw.RoundedBoxEx(2, 4, ScrH()- 127, 75, 122, Color(0,100,100,125), 1, 1, 1, 0)
	draw.RoundedBox(0, 8, ScrH()- 62, 56, 56, Color(5, 5, 5, 100))
	draw.RoundedBox(0, 8, ScrH()- 124, 56, 56, Color(5, 5, 5, 100))


It no longer works. The poly doesn’t draw at all. Please help!

Here are the poly tables as well.



	/* PolyGons */

	Phealth = {{ },{ },{ },{ }}

	Phealth[1]["x"] = 95
	Phealth[1]["y"] = ScrH() - 25
	 
	Phealth[2]["x"] = 105
	Phealth[2]["y"] = ScrH() - 25

	Phealth[3]["x"] = 105
	Phealth[3]["y"] = ScrH() - 10

	Phealth[4]["x"] = 85
	Phealth[4]["y"] = ScrH() - 10


	Bhealth = {{ },{ },{ },{ }}

	Bhealth[1]["x"] = 93
	Bhealth[1]["y"] = ScrH() - 27
	 
	Bhealth[2]["x"] = 325
	Bhealth[2]["y"] = ScrH() - 27

	Bhealth[3]["x"] = 312
	Bhealth[3]["y"] = ScrH() - 8

	Bhealth[4]["x"] = 80
	Bhealth[4]["y"] = ScrH() - 8
	


BTW I realize my RoundedBoxEx arguments are wrong, didn’t have a wiki while making this and forgot. So plz don’t call me a re-re for it :slight_smile:

[editline]12th March 2014[/editline]

GOT IT, had to draw.NoTexture() that bitch.