Need Simplier Method

Hello! Im now about 7 months into my C++ study and i havin been thinking of a basic tiny lil rpg game. Now i got alot of the exp, and level equations down. The problem is that it would seem that the process would b very long, like 50 if statements long (50 levels). Any simplier equation for level instead of:
if(ne==5000){
int level +1
{

I kno this isnt C++ correct but its the idea. the integer 'ne' stands for needed experience. In this case its 5000 assuming that starting level is 1. The other thing is stuff like stats changing. Because the simplier method (if there is one) would do away with my if statement i couldnt for example do this:
if(ne==5000) {
int level +1
int NE=5000+10000
int stats +5
}
Something like that again not being specific on code for simplicitys sake. So then im thinking maybe if i do away with my classes? For example, the value held for the equations increasing level, max experience need (ne), attributes so on and so forth are divided into classes. i thought this would clean up the code a bit. Idk so this is why im here asking all u experts. Help me!! i have different algebraic equations for everything written down, on hand if needed :D
That kind of data shouldn't be directly coded into the structure. You should probably put it in an array like this:
1
2
3
4
5
6
7
xpArray[]={
    5000,
    10000,
    20000,
    40000,
    //...
};

and then check whether a value is above a certain level.
I see!!! awesome idea!! i will give it a shot
Last edited on
Topic archived. No new replies allowed.