Ejemplo n.º 1
0
  public HotSMain() {
    // General
    setPreferredSize(new Dimension(800, 600));
    canvas.add(this);
    setBackground(Color.GRAY);
    frame.setResizable(false);
    frame.setTitle("Heroes of the Forest");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Overworld
    menuScreen.setPreferredSize(new Dimension(800, 150));
    menuScreen.setBackground(Color.DARK_GRAY);
    menuScreen.setVisible(false);

    menuButtons.add(itemsButton);
    menuButtons.add(equipButton);
    menuButtons.add(skillsButton);
    menuButtons.add(statusButton);
    menuButtons.add(settingsButton);
    menuButtons.add(dataButton);

    for (JButton button : menuButtons) {
      menuScreen.add(button);
      button.addActionListener(this);
    }

    canvas.add(menuScreen, BorderLayout.SOUTH);
    ImageIcon bg = new ImageIcon("OverworldBG.jpg");
    background = bg.getImage();

    frame.pack();
    frame.setVisible(true);
    player = new Player();
    enemies.add(new Stalker(375, 200));
    player.defaultPlayer();
    frame.addKeyListener(this);
    frame.addMouseListener(this);
    frame.addMouseMotionListener(this);
    moveTimer.start();
  }