Esempio n. 1
0
  @Override
  public void init(GameContainer gameContainer, StateBasedGame stateBasedGame)
      throws SlickException {
    this.stateBasedGame = stateBasedGame;

    center =
        new Dimension(
            AsaGame.SOURCE_RESOLUTION.width / 2 - 100, AsaGame.SOURCE_RESOLUTION.height / 2);

    resetGame();

    tandwiel1 = new Image(Resource.getPath(Resource.TANDWIEL5));
    tandwiel2 = new Image(Resource.getPath(Resource.TANDWIEL6));
    spinner = new Image(Resource.getPath(Resource.SPINNER));
    spinneroverlay = new Image(Resource.getPath(Resource.SPINNER_OVERLAY));
    background_spinner = new Image(Resource.getPath(Resource.BACKGROUND_SPINNER));
    background_spinner_half = new Image(Resource.getPath(Resource.BACKGROUND_SPINNER_HALF));
    background_spinner_half.setAlpha(0.7f);
    background = new Image(Resource.getPath(Resource.GAME_BACKGROUND));
    selectImage = new Image(Resource.getPath(Resource.SAVE_SCORE));
    choise = new Image(Resource.getPath(Resource.MAKE_YOUR_CHOISE));

    fontBlack = Resource.getFont(Resource.FONT_SANCHEZ, 30, Color.BLACK);

    lens = new Animation();
    lens.setLooping(false);
    for (int i = 0; i < 33; i++) {
      if ((i + "").length() == 1) {
        lens.addFrame(new Image(Resource.getPath("LENS/lens1_0000" + i + ".png")), 550 / 33);
      } else if ((i + "").length() == 2) {
        lens.addFrame(new Image(Resource.getPath("LENS/lens1_000" + i + ".png")), 550 / 33);
      }
    }
    lens.stop();
  }
 @Override
 public void update(GameContainer gc, StateBasedGame sb, float delta) {
   Dice dice = ((Dice) owner);
   DiceManager dm = DiceManager.getInstance();
   if (!dice.isRolling() && !checked) {
     //            int rand = (int) (Math.random()*6);
     //            dice.setResult(rand);
     dm.checkIfAllDicesAreSet();
     anim.setCurrentFrame(numbers.indexOf(dice.getResult() - 1));
     anim.stop();
     checked = true;
   }
 }