Jump to content

Weird widget badge issue


Recommended Posts

Hi all,

I'm encountering a strange issue with my custom badge that can be seen below.

The bar seems to shift upward when decreasing in scale, the numbers match up to how the meter should appear as well as the icon image for the badge. This badge is based from the beaver one and I'm still experimenting on the implementation; apologies in advance, but do assume my implementation is dumb or missing parts.

Spriter project lists:

  • File name as "corruption_meter",
  • Entity name as "corruption_meter",
  • Animation name as "anim" (changed from "anim_90s"; works as well but still bugs).

 37hzci9.png

 

Code analysis:

local function StatusPostConstruct(self)
 if self.owner:HasTag("triggerword") then
  self.Corruptionbadge = self:AddChild(CorruptionBadge("corruption_meter", self.owner))
  self.Corruptionbadge:SetPosition(-80, -40, 0)
  self.Corruptionbadge.num:SetString("Coming soon!")  
   -- debug; (Should I set string to max? 
   -- Research suggests this is controlled another way).
  self.Corruptionbadge.num:SetColour({.9, .3, .3, 3}) -- debugging purposes only
  self.onCORRUPTdelta = nil

  self.inst:ListenForEvent("CORRUPTdelta",
   function(inst)
     -- a raw implementation, proves useful for visual feedback
     self.Corruptionbadge:SetPercent(self.owner.components.corrupted:GetPercent(),
     self.owner.components.corrupted.max)
   end, 
  self.owner)
 end
end

AddClassPostConstruct("widgets/statusdisplays", StatusPostConstruct)

-- Can provide additional code if needed.

Any advice or help(even in general implementation) would be appreciated. Basically I'm looking to create a separate badge that works smoothly for both client and host/server, it would allow me to associate functionality with a separate stat.

Edited by MorickClive
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...