I am making a Bingo game java version of 5x5. I have most of my code done however I am stuck on how to check if a pattern has been made from clicking the buttons. My board is made up of buttons with each having a different id. I will have three patterns to bingo.
Since I have many different classes, I can't really put lots of code here but following are snippets of the code that are related to my question.
Any help would be much appreciated.
Following is a snippet of my code, which shows how I am trying to approach this:
Patterns Class
My patterns are a set of checkboxes, which user can choose from 1-3.
public void patterns(){
if (diagonal.isSelected()){
LogicClass.pattern = 1;
LogicClass.count ++;
}
if (across.isSelected()){
LogicClass.pattern = 2;
LogicClass.count ++;
}
if (diamond.isSelected()){
LogicClass.pattern = 3;
LogicClass.count ++;
}
}
BoardGame Class
public void BingoYAY(){
if((B5.isPressed() && I4.isPressed()
&& N3.isPressed() && G2.isPressed()
&& O1.isPressed()) || (B1.isPressed()
&& I2.isPressed() && N3.isPressed()
&& G4.isPressed() && O5.isPressed())
&& LogicClass.pattern == 1){
}else
if(B5.isPressed() && I4.isPressed()
&& N3.isPressed() && G2.isPressed()
&& O1.isPressed() && LogicClass.pattern == 1){
Bingo.showWinner();
}
}
Aucun commentaire:
Enregistrer un commentaire