Exemple #1
0
  private void movePlayer(int x, int y) {
    if (!(x == 0 && y == 0)) {
      state.movePlayer(x, y);

      if (x == 0 && y == 1 && playerRotation != 0) {
        playerDisplayRotation.initLinearAnimation(0 - playerRotation, 100);
        playerRotation = 0;
      } else if (x == 1 && y == 0 && playerRotation != 90) {
        playerDisplayRotation.initLinearAnimation(90 - playerRotation, 100);
        playerRotation = 90;
      } else if (x == 0 && y == -1 && playerRotation != 180) {
        playerDisplayRotation.initLinearAnimation(180 - playerRotation, 100);
        playerRotation = 180;
      } else if (x == -1 && y == 0 && playerRotation != 270) {
        playerDisplayRotation.initLinearAnimation(270 - playerRotation, 100);
        playerRotation = 270;
      }
    }
  }