havenphillip Posted September 23, 2018 Posted September 23, 2018 I have this rotating thing I want to make a health half-circle but I need to mask half of it. How can I do it? Anyone come across a shader for that? Or can it be done in lua? I looked around but I haven't been able to find one that works for this. Here's my code, if that's useful: Script.player = nil -- entity "Player" Script.pos = Vec2(242,234) -- Vec2 "Position" Script.offset = Vec2(4,3) -- Vec2 "Offset" Script.csize = Vec2(200,200) -- Vec2 "Size" function Script:Start() self.player = self.entity:GetParent() self.tex = Texture:Load("Materials/Developer/bluegrid.tex") end function Script:PostRender(context) local a = Time:GetCurrent() /10 local w = self.csize.x local h = self.csize.y local x = self.pos.x-(Math:Cos(a)*(w/2) - Math:Sin(a)*(h/2)) local y = self.pos.y+(-Math:Sin(a)*(w/2) - Math:Cos(a)*(h/2)) local scale = 1 context:SetRotation(a) context:SetScale(1,1) context:SetBlendMode(Blend.Alpha) context:SetColor(1,1,1,1) context:DrawImage(self.tex, x, y, self.csize.x, self.csize.y) context:SetRotation(0) end Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.