java - libgdx change background when game reset -


i want change background after 3 attempts day night , again after 3 attempts. have put integer in gamerenderer class. created 2 methods drawday , drawnight.

i want change gameover or highscore. idea how set in gameworld?

public void changebg(int x){     if(x == 3){         drawday();}     else if (x == 6){         drawnight();}         x = 0;     }  private void drawnight() {     // todo auto-generated method stub  }  private void drawday() {     // todo auto-generated method stub  } 

what want store current number of attempted tries in preferences, so

private static preferences preferences;   @override public void create() {     preferences = gdx.app.getpreferences(resources.preferencesname);     ...  public static preferences getpreferences() {     return preferences; } 

where add number following:

    int currenttries = mygame.getpreferences().getint("numberoftries");     currenttries++;     currenttries %= 6;     mygame.getpreferences().putint("numberoftries", currenttries);     mygame.getpreferences().flush(); 

afterwards, want check current try count:

 public void changebg(int x){     if(x < 3) {         drawday();     }     else if (x < 6) {         drawnight();     }  } 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -