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

2014/9/15

Advancing in levels

MeccaMaxima MeccaMaxima

2014/9/15

#
How do I get the level to go up after a set amount of time has passed??
danpost danpost

2014/9/15

#
Add an instance int field to your world to count act cycles:
private int actCounter;
add (or include the code within the following block to) an act method in your world class:
public void act()
{
    actCounter++;
    if (actCounter == /* limiting value */ ) {
        // code to level up
    }
}
MeccaMaxima MeccaMaxima

2014/9/16

#
Thankyou so much! You have helped so much in other discussions as well. Would the limiting value be the time or is it another variable??
danpost danpost

2014/9/16

#
MeccaMaxima wrote...
Would the limiting value be the time or is it another variable??
It can be a hard-coded value or you can put the value in a constant field and refer to it.
You need to login to post a reply.