[solved] Player starting health
by Anachronistic · in Torque X Platformer Kit · 10/09/2010 (6:51 am) · 0 replies
i've been able to alter the peppercollectible code so i now have a health bar and a kind of mana bar going off two pickups i have.
my problem is i can't seem to set up the inital health and mana for the player so they are starting on empty.
here is my health bar code (GUI.cs):
public int PepperCount
{
get { return _pepperCount; }
set
{
if (InventoryItemSlot.Equals("Pepper", "Pepper"))
{
if (_peppers.Count > 0)
{
int i = 0;
for (; i < value && i < _peppers.Count; i++)
_peppers[i].Visible = true;
for (; i < _peppers.Count; i++)
_peppers[i].Visible = false;
}
}
}
}
has anyone got any suggestions?
nevermind
oh my gosh i'm so stupid i did it. in the playerdragonactor component within the onregister function:
// set initial HUD values
PlatformerDemoGUI.Instance.PepperCount = _inventory.Item("Pepper").Count = 5;
PlatformerDemoGUI.Instance.LightningCount = _inventory.Item("Lightning").Count = 1;
my problem is i can't seem to set up the inital health and mana for the player so they are starting on empty.
here is my health bar code (GUI.cs):
public int PepperCount
{
get { return _pepperCount; }
set
{
if (InventoryItemSlot.Equals("Pepper", "Pepper"))
{
if (_peppers.Count > 0)
{
int i = 0;
for (; i < value && i < _peppers.Count; i++)
_peppers[i].Visible = true;
for (; i < _peppers.Count; i++)
_peppers[i].Visible = false;
}
}
}
}
has anyone got any suggestions?
nevermind
oh my gosh i'm so stupid i did it. in the playerdragonactor component within the onregister function:
// set initial HUD values
PlatformerDemoGUI.Instance.PepperCount = _inventory.Item("Pepper").Count = 5;
PlatformerDemoGUI.Instance.LightningCount = _inventory.Item("Lightning").Count = 1;