Exemplo n.º 1
0
 public void setScore(int score) {
   scoreString.setScore(score);
   if (score > topScore) {
     topScore = score;
     preferences.putInteger(TOP_SCORE_PREF, topScore);
     preferences.flush();
     topScoreString.setScore(score);
   }
 }
Exemplo n.º 2
0
 public ScoresScreen(VeryAngryRobotsGame game) {
   super(game);
   scoreCam =
       CameraHelper.createCamera2(
           ViewportMode.PIXEL_PERFECT, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, Assets.pixelDensity);
   spriteBatch = new SpriteBatch();
   spriteBatch.setProjectionMatrix(scoreCam.combined);
   scoreString = new ScoreString();
   topScoreString = new ScoreString();
   preferences = Gdx.app.getPreferences(VERY_ANGRY_ROBOTS);
   topScore = preferences.getInteger(TOP_SCORE_PREF, 1000);
   topScoreString.setScore(topScore);
   stateTime = 0.0f;
 }