From cf287833f6432bf7c53fa7023a9fc4ec9ad07275 Mon Sep 17 00:00:00 2001 From: Solargale Date: Sat, 23 Mar 2019 19:04:37 -0600 Subject: [PATCH] Made animation testing same as everyother class, can run from other classes. --- src/AnimationTesting.java | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/AnimationTesting.java b/src/AnimationTesting.java index 00413a3..49707df 100644 --- a/src/AnimationTesting.java +++ b/src/AnimationTesting.java @@ -16,24 +16,27 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; -public class AnimationTesting extends Application { +public class AnimationTesting extends Player { + private ShipWarfareGUI ship; private HBox usAgainstEnemyDivisor; private BorderPane centeringUserShipPane; private Circle cannon; private BorderPane centeringMerchantShipPane; private BorderPane encompassingPane; - public AnimationTesting() throws FileNotFoundException{ - - + /** + * constructor; only runs when a Player object is provided. The constructor is fully encapsulated. + * + * @param player is a Player object that will be copied and the player instance variable is set to the copy. + */ + public AnimationTesting(Player player) { + Player playerDummy = new Player(player); + this.ship = new ShipWarfareGUI(player); + setPlayer(playerDummy); } - public static void main(String[] args) { - launch(args); - } - - public void start(Stage primaryStage) throws Exception { + public void startShipAnimation(Stage primaryStage) throws Exception { Pane root = new Pane(); @@ -114,7 +117,9 @@ public class AnimationTesting extends Application { shotsFired.setNode(cannon); shotsFired.play(); - Scene scene = new Scene(root); + Scene scene = new Scene(root,600,480); + root.getStylesheets().add("styleguide.css"); + primaryStage.setScene(scene); primaryStage.show();