tModLoader Resource bar position

POCKETS

Terrarian
Hey guys, I need a bit of help with the resource bar from ExampleMod.

I have it working fine in game, but the position is not what I needed. Right now, the position is just to the left of the hearts. I suppose for typical resources, this might be alright, but mine works a bit differently, so I need to place it near the player. The problem is, as it currently stands, it is a pixel based position system, which means if you resize the window, or use different resolutions, that bar will always be a certain amount of pixels from either the left or right.

I would like to change this so that it is based on player position, and not pixels. I've tried a few things, but nothing that comes close to getting it tied to the player's position (player center) so that if the window were to be resized, or the player uses a different resolution, the bar is always in the same relative position. Making the bar draggable is not really an option here, as the bar is only visible under certain conditions, among other things.

Just for reference, here's the ExampleMod resource bar code - hastebin
 
Last edited:
Back
Top Bottom