mmeyer49 0 Newbie Poster

I'm almost done with my 2D dungeon game, but for some reason i cannot move when my program calls to move i cannot move ever when i set the Vitality to 100 it sets it to 0. When i remove the params and make it so it will move it still cannot.

Engine.cpp

ENTITY :: ENTITY ()              
{
	m_fpkAction    = NULL;
	m_eState       = eNormal;
	m_strAlias     = "Undefined";
	m_strClass     = "Hero";
	m_iXpos        = 0; m_iYpos        = 0; m_iHp          = 0; m_iMp          = 0;
	m_iMaxHp       = 0; m_iMaxMp       = 0; m_iStrength    = 0; m_iVitality    = 0;
	m_iPhysicalAtk = 0; m_iPhysicalDef = 0; m_iMagickalAtk = 0; m_iMagickalDef = 0;
	m_iMoney       = 0; m_iLevel       = 0; m_iExperience  = 0; m_iSpacesMoved = 0;
string ENTITY :: getVitalString ()
{
 string vitals = ""; 
 
 if (m_iVitality >= 0 && m_iVitality <= 25)        { vitals = "Exhausted"; }
 else if (m_iVitality >= 26 && m_iVitality <= 50)  { vitals = "Tired"; }
 else if (m_iVitality >= 51 && m_iVitality <= 100) { vitals = "Alert"; }
 else if (m_iVitality > 100)                       { vitals = "Psyched"; }
 return vitals; 
}
void ENTITY :: navigate (eMotionDirection eDir)
{
 string feedback = "";
 
 if (m_strClass != "Monster")
 {
  //ofstream output;
  //output.open("error.txt", ios::app);
  //output << "m_strClass = " << m_strClass << endl;
  //output.close();
	 feedback = m_strAlias + " is too tired to move...\n" + m_strClass;
 }
  
 if (m_iVitality > 0)
 {
  switch (eDir)
  {
   case eNorth:    {m_iYpos--;}break;
   case eSouth:    {m_iYpos++;}break;
   case eEast:     {m_iXpos++;}break;
   case eWest:     {m_iXpos--;}break;
   case eNorthWest:{m_iYpos--; m_iXpos--;}break;
   case eNorthEast:{m_iYpos--; m_iXpos++;}break;
   case eSouthWest:{m_iYpos++; m_iXpos--;}break;
   case eSouthEast:{m_iYpos++; m_iXpos++;}break;
  }

  if (m_iYpos < 0) m_iYpos = C_GAMEWORLD_SIZE;
  if (m_iXpos < 0) m_iXpos = C_GAMEWORLD_SIZE;
  if (m_iXpos > C_GAMEWORLD_SIZE) m_iXpos = 0;
  if (m_iYpos > C_GAMEWORLD_SIZE) m_iYpos = 0;
 }
 else
 {
  Common :: pause (center_press_return);
 }  
}
void ENTITY :: giveVitality    (int iAmount) {INC_AND_LIMIT(m_iVitality, iAmount, 255);}
void ENTITY :: takeVitality    (int iAmount) {DEC_AND_LIMIT(m_iVitality, iAmount, 0);}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.