Lawn Gnome
03-21-2006, 03:25 AM
k im trying to make a txt game. i have problems with my exp check function tho. first the code.
/*Level Up Function*/
void level_up()
{
MaxHp=MaxHp+50;
hp=MaxHp;
lvl=lvl+1;
dmg=dmg+5;
cout<<"\n\nYou Gain A Level!!"<<endl;
cout<<"You Are Now Level "<<lvl<<endl;
cin.get();
cin.ignore();
system("cls");
}
/*End Level Up Function*/
/*EXP Check*/
void exp_check()
{
if(exp>=10)
{
level_up();
}
else if(exp>=40)
{
level_up();
}
//will add more later
}
/*End EXP Check*/
this is both my level up and exp check code. i need a way to make it so with the exp check it wont level up everytime it checks becuse the exp is higher then or = to 10. but i cant figure out how to do it. i need so when it levels up the first time, to skip that and go to the second exp needed to level.
/*Level Up Function*/
void level_up()
{
MaxHp=MaxHp+50;
hp=MaxHp;
lvl=lvl+1;
dmg=dmg+5;
cout<<"\n\nYou Gain A Level!!"<<endl;
cout<<"You Are Now Level "<<lvl<<endl;
cin.get();
cin.ignore();
system("cls");
}
/*End Level Up Function*/
/*EXP Check*/
void exp_check()
{
if(exp>=10)
{
level_up();
}
else if(exp>=40)
{
level_up();
}
//will add more later
}
/*End EXP Check*/
this is both my level up and exp check code. i need a way to make it so with the exp check it wont level up everytime it checks becuse the exp is higher then or = to 10. but i cant figure out how to do it. i need so when it levels up the first time, to skip that and go to the second exp needed to level.