Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package AuiAs2.Model;
- import AuiAs2.MathsGame;
- import AuiAs2.ScreenInterface;
- import javax.swing.*;
- public class Model implements ScreenInterface {
- int CURRENT_SCORE = 0;
- final int[] HIGH_SCORES = new int[ScreenInterface.Difficulty.values().length];
- private void updateScores(boolean isCorrect) {
- CURRENT_SCORE = isCorrect ? CURRENT_SCORE+1 : 0;
- }
- public Difficulty getSelectedDiff(ButtonModel selectedDiff) {
- //butNewGame.addActionListener(e -> MathsGame.switchToGame(btgrpDiff.getSelection()));
- System.out.println(selectedDiff);
- return Difficulty.MEDIUM;
- }
- /*
- private boolean checkHighScore() {
- int highScore = MathsGame.HIGH_SCORES[difficulty.getSelectedIndex()];
- if (currentScore > highScore) {
- HIGH_SCORES[difficulty.getSelectedIndex()] = currentScore;
- return true;
- }
- return false;
- }
- private void answerCorrect() {
- System.out.println("Correct!");
- updateScores(true);
- if(checkHighScore()){
- statusLab.setText("New High Score!");
- }
- else {
- statusLab.setText("Correct!");
- }
- startGame(); //starts a new round
- }
- private void answerIncorrect() {
- statusLab.setText("Incorrect!");
- updateScores(false);
- retryBut.setVisible(true); //displays button which allows user to retry without returning to setup
- }
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement