Game Development Community

Health Bar in Platformer

by Thinnox (#0001) · in Torque Game Builder · 10/11/2008 (6:45 am) · 1 replies

So I have been trying to create a health bar for a platformer and the only thing stopping me is how to scale an image in the gui builder. I would use getExtent(); but that returns a string with width and height. What I want to do is simply reduce it's width as a % of health. That's not hard to do but I need a way of isolating the width from the height.

I can't use a regular object and have set width and height because I need the bar to move with the camera

#1
11/30/2008 (5:05 am)
// Assuming you've got the size info using getExtent(), and set it in a variable %extent
%width = getWord(%extent, 0);