private void saveExitButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_saveExitButtonActionPerformed
   if (manager.currentGame.twoPlayers) {
     UserDataHandler.SaveCrossGame(manager.currentUser[0], manager.currentGame);
     UserDataHandler.SaveCrossGame(manager.currentUser[1], manager.currentGame);
     UserDataHandler.SaveUserData(manager.currentUser[0]);
     UserDataHandler.SaveUserData(manager.currentUser[1]);
   } else {
     UserDataHandler.SaveCrossGame(manager.currentUser[0], manager.currentGame);
     UserDataHandler.SaveUserData(manager.currentUser[0]);
   }
   optionsDialog.setVisible(false);
   manager.ReplacePanel(new MenuPanel(), 400, 300);
 } // GEN-LAST:event_saveExitButtonActionPerformed
 private void jButton2ActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton2ActionPerformed
   endGameDialog.dispose();
   manager.ReplacePanel(new MenuPanel(), 400, 300);
 } // GEN-LAST:event_jButton2ActionPerformed
 /** Creates new form GamePanel */
 public GamePanel() {
   manager = GUIManager.getGUIManager();
   cg = new crossGraphic();
   initComponents();
   jSplitPane1.setRightComponent(cg);
 }
예제 #4
0
파일: Player.java 프로젝트: Faust852/pr1
  public void render(Graphics2D g) {
    g.fillRect((int) pos.xPos, (int) pos.yPos, width, height);

    if (animationState == 0) {
      g.drawImage(
          ani_up.sprite,
          (int) pos.xPos - width / 2,
          (int) pos.yPos - height,
          width * scale,
          height * scale,
          null);
      if (up) {
        ani_up.update(System.currentTimeMillis());
      }
    }
    if (animationState == 1) {
      g.drawImage(
          ani_down.sprite,
          (int) pos.xPos - width / 2,
          (int) pos.yPos - height,
          width * scale,
          height * scale,
          null);
      if (down) {
        ani_down.update(System.currentTimeMillis());
      }
    }
    if (animationState == 2) {
      g.drawImage(
          ani_right.sprite,
          (int) pos.xPos - width / 2,
          (int) pos.yPos - height,
          width * scale,
          height * scale,
          null);
      if (right) {
        ani_right.update(System.currentTimeMillis());
      }
    }
    if (animationState == 3) {
      g.drawImage(
          ani_left.sprite,
          (int) pos.xPos - width / 2,
          (int) pos.yPos - height,
          width * scale,
          height * scale,
          null);
      if (left) {
        ani_left.update(System.currentTimeMillis());
      }
    }
    if (animationState == 4) {
      g.drawImage(
          ani_idle.sprite,
          (int) pos.xPos - width / 2,
          (int) pos.yPos - height,
          width * scale,
          height * scale,
          null);
      ani_idle.update(System.currentTimeMillis());
    }

    g.drawRect(
        (int) pos.xPos - renderDistanceWidth * 32 / 2 + width / 2,
        (int) pos.yPos - renderDistanceHeight * 32 / 2 + height / 2,
        renderDistanceWidth * 32,
        renderDistanceHeight * 32);

    guiM.render(g);
    hudM.render(g);
  }