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

2013/6/11

Some annoying bugs

Solringolt Solringolt

2013/6/11

#
My game is nearly an end stage but I have some problems when playing it. The first time you play it everything works but if you die or just click reset I have strange issues like I directly begin at the level I died or have an animation of evolution when I shouldn't have one. Is that a problem of variables that aren't set to default or something like that? Here is my Scenario http://www.greenfoot.org/scenarios/7845 If you find any other thing that are bad coded tell me!
tollpatch tollpatch

2013/6/11

#
Without having a look to your scenario it sounds like you expact: Most of the problems seems to be initialising problems. Either set the variables to definite values or make shure they are private and redefined when the method is called again.
davmac davmac

2013/6/12

#
If you have 'static' variables, the are not reset when you click reset. You must reset them manually. You should avoid using static variables when possible.
Solringolt Solringolt

2013/6/12

#
Heuuuu.... and how can I avoid them?
    public static int currentLevel = 0;
    public static Counter counter;
    public static int actualPannel = 0;
    
    public static boolean menuDisplayed = false;
    public static boolean evolutionDisplayed = false;
    public static boolean backgroundSound;
    public static boolean soundEffects;
    public static int gameDifficulty = 2;
    public static boolean gameDifficultySet = true;
    public static int procaryoteLevel = 1;
    public static boolean gameWon = false;
    
    public static boolean evolutionAnimationBefore = false;
    public static boolean evolutionAnimationAfter = false;
    public static boolean duringAnimation = false;
I have all these....
You need to login to post a reply.