示例#1
0
 /*
  *function who transformed all the caracteristic of InfoGame in a string
  *to sent them at the new server
  */
 public static String infoGame() {
   String info = "";
   try {
     info = Integer.toString(game.getNrofghosts());
     info += " " + Integer.toString(game.getDeathcounter());
     int[] ghostx = game.getGhostx();
     for (int i = 0; i < game.getNrofghosts(); i++) {
       info += " " + Integer.toString(ghostx[i]);
     }
     int[] ghosty = game.getGhosty();
     for (int i = 0; i < game.getNrofghosts(); i++) {
       info += " " + Integer.toString(ghosty[i]);
     }
     short[] screenData = game.getScreendata();
     for (int i = 0; i < screenData.length; i++) {
       info += " " + Integer.toString(screenData[i]);
     }
     info += " " + Integer.toString(game.getNumberPlayer());
     info += " " + Integer.toString(game.getNbPlayerExpected());
     info += " " + Integer.toString(game.getNbPlayerWaiting());
     info += " " + Integer.toString(game.getNbrPlayerInGame());
     info += " " + String.valueOf(game.isPlaying());
     info += " " + String.valueOf(game.isWaiting());
     info += " " + String.valueOf(game.isEnded());
     info += " " + String.valueOf(game.isPause());
     info += " " + game.getPlayerCallPause();
   } catch (Exception exc) {
     exc.printStackTrace();
   }
   return info;
 }
示例#2
0
 public void finished() {
   int numberPlayer = game.getNumberPlayer();
   numberFinished += 1;
   if (numberFinished == numberPlayer) {
     // Ghosts update
     int nrOfGhosts = game.getNrofghosts();
     if (nrOfGhosts < maxghosts) {
       game.setNrofghosts(nrOfGhosts++);
     }
     if (currentspeed < maxspeed) {
       currentspeed++;
     }
     LevelInit();
   }
 }