Hey guys.
I was looking on the forums to find a way to center a drawn image. Couldn't find a solution. I figured it out and then thought hey this might be useful. So I am going to post some code here. You guys might find easier ways to do this. But whatevs hope this helps someone.
local a = self.player.script.stamina
local b = self.player.script.maxstamina
local d = self.staminaBarColor
local e = a / b
local sx = 70
local sy = 10
local hbc = self.staminabarbackColor
local ix = 105
local iy = 5
local c1 = 90 * e
local ix2 = ix + (90 - c1) / 2
local iy2 = iy + (90 - c1) / 2
--Background Square
context:SetColor(0.2,0.2,0.2,1)
context:DrawRect(105, 5, 90 , 90)
context:SetColor(1,1,1,1)
context:DrawImage(self.run ,ix2, iy2, c1 , c1)