Search in sources :

Example 1 with SettingsPane

use of GUI.SettingsPane in project cardgame1 by joey101937.

the class InputHandler method mouseClicked.

@Override
public void mouseClicked(MouseEvent e) {
    double x = e.getX() / Board.xScale;
    double y = e.getY() / Board.yScale;
    System.out.println(e.getX() / Board.xScale + ", " + e.getY() / Board.yScale);
    // if its not our turn, ignore it
    if (!Board.playerHero.turn || !enabled)
        return;
    Card clickedCard = InputHandler.getCardAt(e.getX() / Board.xScale, e.getY() / Board.yScale);
    if (clickedCard != null && clickedCard.isTargeted == false) {
        // cast with null param becuase there is no target
        clickedCard.cast(null);
    }
    if (x < 35 && y < 35) {
        // options gear is in top left, 0,0 and is 35x35
        LegacyGUI.settings = new SettingsPane();
    }
    if (x > 400 + Board.playerHero.picture.getWidth() && x < 400 + Board.playerHero.picture.getWidth() + SpriteHandler.leftArrow.getWidth()) {
        if (Board.playerHero == Board.botHero) {
            if (y > 850 && y < 850 + SpriteHandler.leftArrow.getHeight()) {
                onEndTurn();
            }
        } else {
            // player is tophero
            if (y < SpriteHandler.leftArrow.getHeight()) {
                onEndTurn();
            }
        }
    }
}
Also used : SettingsPane(GUI.SettingsPane) Card(Cards.Card)

Aggregations

Card (Cards.Card)1 SettingsPane (GUI.SettingsPane)1