About Store Forum Documentation Contact



Post Reply 
Loading a Progress Bar and setting progress
Author Message
MikeyUchiha Offline
Member

Post: #1
Loading a Progress Bar and setting progress
There isn't a tutorial on this at all so I'm a little stuck. Basically, I want to create a Health Bar that increases to the max and decreases. Inside the progress bar. I was able to get the bar drawn in game. But, for some reason, it won't update the color. This is what I've got so far. A push in the right direction would be greatly appreciated.

MainSkillBar.h
Code:
struct MainSkillBar
{
    GuiObjs gobjs;
    Progress *health;

    void create();

    void update();
}
extern MSB;

MainSkillBar.cpp
Code:
/******************************************************************************/
#include "stdafx.h"
#include "Main.h"
/******************************************************************************/
MainSkillBar MSB;
/******************************************************************************/
// MANAGE
/******************************************************************************/
void MainSkillBar::create()
{
    gobjs.load("gui/obj/health.gobj"); Gui+=gobjs;

    health=&gobjs.getProgress("Health");
}
/******************************************************************************/
// UPDATE
/******************************************************************************/
void MainSkillBar::update()
{
    UInt x = ATR.GetAttributeValue(HEALTH);
    Progress health;
    Gui.update();
    health.set(x * .10);
}

Thanks for your time and help. wink
07-23-2011 09:15 PM
Find all posts by this user Quote this message in a reply
Dandruff Offline
Member

Post: #2
RE: Loading a Progress Bar and setting progress
try just putting 0.5 in there and see if it works. If it doesn't, try removing the second definition of health in ::update() and do health->set(0.5f);
07-24-2011 12:45 AM
Find all posts by this user Quote this message in a reply
MikeyUchiha Offline
Member

Post: #3
RE: Loading a Progress Bar and setting progress
yes, that worked perfectly Dandruff. I actually figured that out RIGHT before you posted. But thanks so much for the help. And I did remove the second definition of Progress health;

In case anyone else has these same issues. ^_^
07-24-2011 01:21 AM
Find all posts by this user Quote this message in a reply
Post Reply