diff --git a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/minigames/GameEngineController.java b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/minigames/GameEngineController.java index 27d6366..206cba1 100644 --- a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/minigames/GameEngineController.java +++ b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/minigames/GameEngineController.java @@ -149,27 +149,27 @@ private void refreshMetrics() { int seconds = secondsRemaining % 60; String formattedTime = String.format("%02d:%02d:%02d", hours, minutes, seconds); - if (currentScore > 150) { + if (currentScore >= 150) { currentRank = 'S'; rankEffectString = "Extremely good fortune awaits " + chosenStock.getSymbol(); fortuneToSet = 0.10; - } else if (currentScore > 120) { + } else if (currentScore >= 120) { currentRank = 'A'; rankEffectString = "Really good fortune awaits " + chosenStock.getSymbol(); fortuneToSet = 0.5; - } else if (currentScore > 80) { + } else if (currentScore >= 80) { currentRank = 'B'; rankEffectString = "Good fortune awaits " + chosenStock.getSymbol(); fortuneToSet = 0.2; - } else if (currentScore > 50) { + } else if (currentScore >= 50) { currentRank = 'C'; rankEffectString = "Bad fortune awaits " + chosenStock.getSymbol(); fortuneToSet = -0.2; - } else if (currentScore > 20) { + } else if (currentScore >= 20) { currentRank = 'D'; rankEffectString = "Really bad fortune awaits " + chosenStock.getSymbol(); fortuneToSet = -0.5; diff --git a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/minigames/MiniGamesView.java b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/minigames/MiniGamesView.java index 633c400..dad45a7 100644 --- a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/minigames/MiniGamesView.java +++ b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/minigames/MiniGamesView.java @@ -122,17 +122,18 @@ public void showHelpSection() { VBox textContainer = new VBox(); textContainer.getStyleClass().add("minigames-help-text-vbox"); - textContainer.getChildren().add(createTextParagraph("MINIGAMES", + textContainer.getChildren().add(createTextParagraph("Minigames", "Welcome to the minigames section! Here you can boost a selected stock (choose in dashboard page)" - + " by playing minigames! A minigame takes one minute, and you are able to exit before the time runs out." + + " by playing minigames! A minigame takes 20 seconds, and you are able to exit before the time runs out." + " This will not have any negative effects. " + " When you complete a minigame, you get a rank based on your score. Higher scores yield a higher rank." + " The higher rank you are at the end of the round, the more fortune the selected stock will get." - + " Every stock can only be boosted one time per week by playing minigames, so play minigames for all your investments!")); + + " Every stock can only be boosted one time per week by playing minigames, so play minigames for all your investments!" + + " (Multiple minigames for same stock overrides previous fortune.)")); textContainer.getChildren().add(createTextParagraph("What are minigames?", "A minigame is a short interactive experience where you are able to gain points by performing" - + " task(s) that are differ from minigame to minigame. Each minigame session takes exactly one minute to complete" + + " task(s) that are differ from minigame to minigame. Each minigame session takes 20 seconds to complete" + " from start to finish, and you will gain a report based on your performance at the end of the round." + " You can also choose to exit before a round ends to go back, but note that quitting after the round ends" + " will still cause the effect.")); @@ -146,11 +147,12 @@ public void showHelpSection() { "In the minigame page, you can see your selected stock. This stock will then get a" + " positive or negative flat percent amount added to their next weekly price change, based on your rank." + " This is called the stocks fortune." - + " Each stock can only be manipulated once per week by playing minigames, so be sure to" - + " play minigames for all your investments!")); + + " Each stock can only have a single fortune active per week, so be sure to" + + " play minigames for all your investments! Playing multiple minigames for the same" + + " stock will override the stocks' fortune.")); textContainer.getChildren().add(createTextParagraph("Minigame 1: Clicker Minigame", - "Click the primary action tile to increase points. Balance your point allocation strategy between immediate click returns and structural upgrades.")); + "Click the button to earns points. The button changes location after every click!")); textContainer.getChildren().add(createTextParagraph("Minigame 2: Find The Stock", "Scan the choice matrix panel grid and find the symbol matching the target description. Incorrect selections will deduct points.")); diff --git a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/minigames/games/ClickerGame.java b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/minigames/games/ClickerGame.java index b7fd9d7..3fe6d86 100644 --- a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/minigames/games/ClickerGame.java +++ b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/minigames/games/ClickerGame.java @@ -6,67 +6,71 @@ import java.util.function.IntConsumer; import javafx.scene.Node; import javafx.scene.control.Button; -import javafx.scene.layout.VBox; +import javafx.scene.layout.Pane; /** - * Clicker minigame, found in the - * {@link edu.ntnu.idi.idatt2003.g40.mappe.view.widgets.minigames.MiniGamesView}. + * Clicker minigame where the goal is to hit the targets as much + * as possible. * *
Extends {@link ViewElement}
* *Implements {@link GameGimmick}
* */ public final class ClickerGame - extends ViewElementCalculates maximum allowed x and y position + * based on the view/button width/height.
+ */ + private void teleportTarget() { + + double maxX = getRootPane().getWidth() - clickBtn.getWidth(); + double maxY = getRootPane().getHeight() - clickBtn.getHeight(); + + double randomX = Math.random() * maxX; + double randomY = Math.random() * maxY; + + clickBtn.setLayoutX(Math.max(10, randomX)); + clickBtn.setLayoutY(Math.max(10, randomY)); } @Override diff --git a/src/main/resources/styles.css b/src/main/resources/styles.css index 8b78901..2e10832 100644 --- a/src/main/resources/styles.css +++ b/src/main/resources/styles.css @@ -862,7 +862,7 @@ -fx-text-fill: #000000; -fx-text-alignment: center; -fx-pref-height: 250px; - -fx-min-height: 200px; + -fx-min-height: 100px; -fx-max-width: 350px; } @@ -991,12 +991,8 @@ } .clicker-minigame-clickBtn { - -fx-pref-width: 100; - -fx-pref-height: 100; -} - -.clicker-minigame-upgradeBtn { - -fx-text-alignment: center; + -fx-pref-width: 80; + -fx-pref-height: 80; } /*--------------- TIMED INPUT GAME -------------*/ .time-inputs-minigame-root {