HELP) Swap bitmaps in a gui to display remaining lives
by William James · in Torque Game Builder · 02/07/2008 (7:49 pm) · 1 replies
I have 3 bitmaps that display the player's remaining lives (life1,life2,life3). How would I get it to change the bitmap depending on how many lives left? Would I put the if statements in the .gui file? I'll keep searching other post. I think the healthbar examples I've seen around may help.
About the author
Associate Phillip O'Shea
Violent Tulip
function updateLivesGui(%this) { %livesLeft = %this.Lives; %i = 1; while (isObject("life" @ %i) { %object = "life" @ %i; %object.Visible = (%livesLeft == %i); } }That should loop through all of the elements with the name "life1"..."lifeN" and change them to hidden while the nth life is shown. You could change the condition to "<=" rather than "==" to make them display differently.