コード例 #1
0
  /** Deactivate this engine and reset it to original state. */
  @Override
  public void deactivate() {
    super.deactivate();

    timestamp = 0;
    sprites.clear();
    sprites.add(bgr);
  }
コード例 #2
0
  @Override
  public void initGame() {
    URL bgrURL = getClass().getResource("../../resources/imgBonus.png");
    try {
      BGR_IMAGE = ImageIO.read(bgrURL);
      widthScale = (double) DIM.width / BGR_IMAGE.getWidth(null);
      heightScale = (double) DIM.height / BGR_IMAGE.getHeight(null);
      sprites = new Group<GameSprite>();

      /* Add sprites. */
      bgr = new GameSprite(DIM, 0, 0, BGR_IMAGE);
      bgr.setScales(widthScale, heightScale);
      sprites.add(bgr);
    } catch (Exception ex) {
      Logger.getLogger(Bonus.class.getName()).log(Level.SEVERE, null, ex);
    }
  }