This site requires JavaScript, please enable it in your browser!
Greenfoot back
ddvink
ddvink wrote ...

2013/10/25

Leveling once

ddvink ddvink

2013/10/25

#
My char is constantly leveling up, after getting his XP, but I just want it to do it once.
  // Temporary check for experience and level
        if(rogueExperience >= 1000){
            levelUp();
        }
Yours, Dennis
danpost danpost

2013/10/25

#
You can add a Boolean to your char to determine if levelUp has been done or not and change the if to:
if (!leveledUp && rogueExperience >= 1000)
{
    leveledUp = true;
    levelUp();
}
You need to login to post a reply.