diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/CommunityMapController.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/CommunityMapController.java new file mode 100644 index 0000000000000000000000000000000000000000..3dc79401a4a89941e5bcffa4b07dacbb45c14817 --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/CommunityMapController.java @@ -0,0 +1,73 @@ +package de.hdm_stuttgart.battlearena.Controller; + +import de.hdm_stuttgart.battlearena.Controller.Utilities.SceneLoader; +import javafx.beans.property.SimpleStringProperty; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.fxml.FXML; +import javafx.fxml.Initializable; +import javafx.geometry.Rectangle2D; +import javafx.scene.control.TableColumn; +import javafx.scene.control.TableView; +import javafx.scene.control.cell.PropertyValueFactory; +import javafx.scene.layout.VBox; +import javafx.stage.Screen; + +import java.net.URL; +import java.util.ResourceBundle; + +public class CommunityMapController implements Initializable { + @FXML + private VBox parent; + @FXML + private TableView<DataItem> tableView; + @FXML + private TableColumn<DataItem, String> name; + + Rectangle2D screen = Screen.getPrimary().getVisualBounds(); + + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + tableView.setOnMouseClicked(mouseEvent -> System.out.println(tableView.getWidth())); + setTableView(); + } + + private void setTableView() { + tableView.setMinHeight(screen.getHeight() * 0.69); + tableView.setMinWidth(screen.getWidth() * 0.66); + + name.setCellValueFactory(new PropertyValueFactory<>("name")); + ObservableList<DataItem> data = FXCollections.observableArrayList( + new DataItem("Item A"), + new DataItem("Item B"), + new DataItem("Item C") + ); + + tableView.setItems(data); + } + +// TODO: create map preview + + @FXML + private void backButton() { // for some reason compiler doesn't recognize method usage when 'back' is used as method name. Any other method name works however + parent.getChildren().clear(); + parent.getChildren().add(new SceneLoader().loadScene("MapForge")); + } + +// test values TODO: replace with db + public static class DataItem { + private final SimpleStringProperty name; + + public DataItem(String name) { + this.name = new SimpleStringProperty(name); + } + + public String getName() { + return name.get(); + } + + public SimpleStringProperty nameProperty() { + return name; + } + } +} diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/CreditsController.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/CreditsController.java index a6e47b9d714df5d509ec60ac27bd6ac89029fa5f..bd8d67fc8262984ee946d5890286b10d08f2c77f 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/CreditsController.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/CreditsController.java @@ -1,5 +1,7 @@ package de.hdm_stuttgart.battlearena.Controller; +import de.hdm_stuttgart.battlearena.Controller.Utilities.CreateMediaPlayer; +import de.hdm_stuttgart.battlearena.Controller.Utilities.MusicPlayerSingleton; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; @@ -16,9 +18,9 @@ import java.util.ResourceBundle; public class CreditsController implements Initializable { @FXML - public BorderPane parent; + private BorderPane parent; @FXML - public MediaView mediaView; + private MediaView mediaView; private MediaPlayer mediaPlayer; private final File file = new File("src/main/resources/videos/credits.mp4"); @@ -31,7 +33,7 @@ public class CreditsController implements Initializable { } private void createMediaPlayer() { - mediaPlayer = new CreateMediaPlayer().getMediaPlayer(mediaView, file, parent); + mediaPlayer = new CreateMediaPlayer().getMediaPlayer(mediaView, file, true, parent); mediaView.setMediaPlayer(mediaPlayer); mediaPlayer.setOnEndOfMedia(this::videoEnd); diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/Enum/GameMode.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/Enum/GameMode.java new file mode 100644 index 0000000000000000000000000000000000000000..1979fc24fa3fbaf955b93b4b53942edfd080080c --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/Enum/GameMode.java @@ -0,0 +1,6 @@ +package de.hdm_stuttgart.battlearena.Controller.Enum; + +public enum GameMode { + LOCAL, + NETWORK +} \ No newline at end of file diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/Enum/GameState.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/Enum/GameState.java new file mode 100644 index 0000000000000000000000000000000000000000..1ea713b41a90fa593348760d6a6be8c9f0ed1a62 --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/Enum/GameState.java @@ -0,0 +1,9 @@ +package de.hdm_stuttgart.battlearena.Controller.Enum; + +public enum GameState { + MENU, + PAUSE, + PLAYING, + LOST, + WON +} \ No newline at end of file diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/Enum/PlayerMode.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/Enum/PlayerMode.java new file mode 100644 index 0000000000000000000000000000000000000000..fb864e26dcdce0777bc7301cfeb51007063ba46f --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/Enum/PlayerMode.java @@ -0,0 +1,6 @@ +package de.hdm_stuttgart.battlearena.Controller.Enum; + +public enum PlayerMode { + PLAYER_ONE, + PLAYER_TWO +} \ No newline at end of file diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/GameSceneController.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/GameSceneController.java index 2d90bb00e2c3503261084d7acf6b1dfd98593c61..dc9b88e85c746bab7c651e5a6baae246eb4b94c4 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/GameSceneController.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/GameSceneController.java @@ -1,5 +1,9 @@ package de.hdm_stuttgart.battlearena.Controller; +import de.hdm_stuttgart.battlearena.Controller.Enum.GameMode; +import de.hdm_stuttgart.battlearena.Controller.Enum.GameState; +import de.hdm_stuttgart.battlearena.Controller.Enum.PlayerMode; +import de.hdm_stuttgart.battlearena.Model.DataStorage.Classes.RuntimeInfo; import de.hdm_stuttgart.battlearena.Model.Entity.EntityClass; import de.hdm_stuttgart.battlearena.Model.Entity.EntityFactory; import de.hdm_stuttgart.battlearena.Model.Entity.EntityType; @@ -30,11 +34,15 @@ public class GameSceneController implements Initializable { InputHandler inputHandler = InputHandler.getInstance(); + RuntimeInfo runtimeInfo = RuntimeInfo.getInstance(); + + GameMode gameMode = runtimeInfo.getGameMode(); + IEntity player; IEntity enemy; - EntityClass playerClass = EntityClass.HUMAN; - EntityClass enemyClass = EntityClass.HUMAN; + EntityClass playerOneClass = runtimeInfo.getPlayerOneClass(); + EntityClass playerTwoClass = runtimeInfo.getPlayerTwoClass(); TileManager tileManager; @@ -46,7 +54,7 @@ public class GameSceneController implements Initializable { "4 1 1 1 2 2 4 1 1 1 1 1 1 1 3 1 2 3 " + "4 1 1 1 2 2 4 1 3 3 3 1 1 1 3 2 2 3 " + "4 1 1 1 2 2 4 1 1 1 1 1 1 1 3 2 1 3 " + - "4 1 1 1 2 2 4 3 3 1 4 3 3 3 3 2 1 3 " + + "4 1 5 1 2 2 4 3 3 1 4 3 3 3 3 2 1 3 " + "4 1 1 1 1 1 1 2 2 2 1 1 1 1 1 1 1 3 " + "4 1 1 1 2 2 4 3 3 1 3 3 3 3 3 2 1 3 " + "4 1 1 1 1 2 4 3 3 1 3 3 3 3 3 1 1 3 " + @@ -59,7 +67,7 @@ public class GameSceneController implements Initializable { "4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3"; int horizontalTileCount = 18; int verticalTileCount = 18; - int diffTileCount = 5; + int diffTileCount = 6; int scaledTileSize = 48; @@ -68,11 +76,20 @@ public class GameSceneController implements Initializable { graphicsContext2D = canvas2D.getGraphicsContext2D(); graphicsContext2D.setImageSmoothing(false); - player = EntityFactory.createEntity(EntityType.PLAYER, graphicsContext2D, inputHandler, playerClass, this); - enemy = EntityFactory.createEntity(EntityType.ENEMY_PLAYER, graphicsContext2D, inputHandler, enemyClass, this); + player = EntityFactory.createEntity(EntityType.PLAYER, graphicsContext2D, inputHandler, + playerOneClass, this, PlayerMode.PLAYER_ONE); + if (gameMode == GameMode.NETWORK) { + enemy = EntityFactory.createEntity(EntityType.NETWORK_PLAYER_TWO, graphicsContext2D, inputHandler, + playerTwoClass, this, PlayerMode.PLAYER_TWO); + } else { + enemy = EntityFactory.createEntity(EntityType.PLAYER, graphicsContext2D, inputHandler, + playerTwoClass, this, PlayerMode.PLAYER_TWO); + } tileManager = new TileManager(graphicsContext2D, diffTileCount, horizontalTileCount, verticalTileCount, mapString); + runtimeInfo.setGameState(GameState.PLAYING); + AnimationTimer gameLoop = new AnimationTimer() { @Override public void handle(long l) { @@ -89,18 +106,25 @@ public class GameSceneController implements Initializable { player.updateEntityMovement(this); enemy.updateEntityMovement(this); player.attack(enemy, graphicsContext2D); + enemy.attack(player, graphicsContext2D); } private void renderContent(GraphicsContext graphicsContext) { tileManager.renderMap(); player.renderEntity(graphicsContext); enemy.renderEntity(graphicsContext); + player.checkHealTile(player, graphicsContext2D); + enemy.checkHealTile(enemy, graphicsContext2D); } public IEntity getEnemy() { return enemy; } + public IEntity getPlayer() { + return player; + } + public TileManager getTileManager() { return tileManager; } diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/IntroController.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/IntroController.java index 7a77864cb6349989b9ee99f84e56f98932683146..2c4472104e35751cedb56601d0b5f6b13f72e278 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/IntroController.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/IntroController.java @@ -1,5 +1,6 @@ package de.hdm_stuttgart.battlearena.Controller; +import de.hdm_stuttgart.battlearena.Controller.Utilities.CreateMediaPlayer; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; @@ -17,9 +18,9 @@ import java.util.ResourceBundle; public class IntroController implements Initializable { @FXML - public MediaView mediaView; + private MediaView mediaView; @FXML - public BorderPane introParent; + private BorderPane introParent; private final String fileName = "src/main/resources/videos/"; // nextVideo() will iterate through this array so the next video will be played TODO: change the videos to non memes lmao private final String[] videos = {"sony.mp4", "gamecube.mp4", "gameboy.mp4", "monke.mp4"}; @@ -36,7 +37,7 @@ public class IntroController implements Initializable { private void createMediaPlayer() { // initializing this.mediaPlayer - mediaPlayer = new CreateMediaPlayer().getMediaPlayer(mediaView, file, introParent); + mediaPlayer = new CreateMediaPlayer().getMediaPlayer(mediaView, file, true, introParent); mediaView.setMediaPlayer(mediaPlayer); mediaPlayer.setOnEndOfMedia(() -> { @@ -58,9 +59,10 @@ public class IntroController implements Initializable { } private void videoEnd() { +// TODO: check if player exists try { mediaPlayer.dispose(); - introParent.getScene().setRoot(FXMLLoader.load(Objects.requireNonNull(getClass().getResource("/fxml/MenuBorderPane.fxml")))); + introParent.getScene().setRoot(FXMLLoader.load(Objects.requireNonNull(getClass().getResource("/fxml/PlayerCreateScene.fxml")))); } catch (IOException e) { throw new RuntimeException(); } diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/LocalCreateController.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/LocalCreateController.java index 12f6d654caa5d116dbb0d6be8fcf8b03d25747f8..69b2cb5b336306ffa11e72ad169745d1c83c9cd4 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/LocalCreateController.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/LocalCreateController.java @@ -1,23 +1,44 @@ package de.hdm_stuttgart.battlearena.Controller; +import de.hdm_stuttgart.battlearena.Controller.Utilities.SceneLoader; import javafx.fxml.FXML; -import javafx.fxml.FXMLLoader; +import javafx.fxml.Initializable; +import javafx.scene.control.TitledPane; +import javafx.scene.control.ToggleButton; +import javafx.scene.control.ToggleGroup; import javafx.scene.layout.VBox; -import java.io.IOException; -import java.util.Objects; +import java.net.URL; +import java.util.ResourceBundle; -public class LocalCreateController { - @FXML public VBox parent; +public class LocalCreateController implements Initializable { + @FXML + private VBox parent; + @FXML + private TitledPane roundsTitledPane; + @FXML + private ToggleGroup rounds; private final SceneLoader sceneLoader = new SceneLoader(); - public void playScene() { + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + rounds.selectedToggleProperty().addListener((observableValue, oldToggle, newToggle) -> { + if (rounds.getSelectedToggle() != null) { + ToggleButton selected = (ToggleButton) rounds.getSelectedToggle(); + roundsTitledPane.setText(selected.getText()); + } + }); + } + @FXML + private void backButton() { parent.getChildren().clear(); parent.getChildren().add(sceneLoader.loadScene("Play")); } - public void skinSelectionScene() { + @FXML + private void skinSelectionScene() { parent.getChildren().clear(); parent.getChildren().add(sceneLoader.loadScene("SkinSelection")); } + } diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/MainMenuController.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/MainMenuController.java index 5a8c9dea297cc86f74b13911c31a9318d66f6178..c71e7fc4804f06df9f0249a24e102b057c55ba7a 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/MainMenuController.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/MainMenuController.java @@ -1,38 +1,62 @@ package de.hdm_stuttgart.battlearena.Controller; +import de.hdm_stuttgart.battlearena.Controller.Utilities.SceneLoader; import javafx.fxml.FXML; +import javafx.fxml.Initializable; import javafx.scene.control.Button; import javafx.scene.layout.VBox; +import javafx.stage.Screen; import javafx.stage.Stage; -public class MainMenuController { +import java.net.URL; +import java.util.ResourceBundle; + +public class MainMenuController implements Initializable { @FXML - public VBox parent; + private VBox parent; @FXML - public Button exitButton; + private Button exitButton; private final SceneLoader sceneLoader = new SceneLoader(); private void switchScene(String name) { parent.getChildren().clear(); parent.getChildren().add(sceneLoader.loadScene(name)); } - public void playScene() { + + @FXML + private void playScene() { switchScene("Play"); } - public void statisticsScene() { + @FXML + private void mapScene() { + switchScene("MapForge"); + } + + @FXML + private void statisticsScene() { switchScene("Statistics"); } - public void optionsScene() { - switchScene("Options"); + @FXML + private void settingsScene() { + switchScene("Settings"); } - public void exit() { + @FXML + private void exit() { Stage stage = (Stage) exitButton.getScene().getWindow(); stage.close(); } - -// TODO: create skin selection scene + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + Screen screen = Screen.getPrimary(); + if (screen.getDpi() >= 119) { + parent.setSpacing(30); + parent.setStyle("-fx-font-size: 40"); + } else { + parent.setStyle("-fx-font-size: 50"); + } + } } diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/MapForgeController.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/MapForgeController.java new file mode 100644 index 0000000000000000000000000000000000000000..7f57a6dd566a493f12e2c9ffdea4772df823f130 --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/MapForgeController.java @@ -0,0 +1,51 @@ +package de.hdm_stuttgart.battlearena.Controller; + +import de.hdm_stuttgart.battlearena.Controller.Utilities.MusicPlayerSingleton; +import de.hdm_stuttgart.battlearena.Controller.Utilities.SceneLoader; +import javafx.fxml.FXML; +import javafx.fxml.FXMLLoader; +import javafx.scene.layout.VBox; + +import java.io.IOException; +import java.util.Objects; + +public class MapForgeController { + @FXML + private VBox parent; + SceneLoader sceneLoader = new SceneLoader(); + + @FXML + private void mapEditorScene() { + try { + parent.getScene().setRoot(FXMLLoader.load(Objects.requireNonNull(getClass().getResource("/fxml/PlayerCreateScene.fxml")))); + MusicPlayerSingleton.getInstance().getMediaPlayer().dispose(); + } catch (IOException e) { + throw new RuntimeException(); + } + } + + @FXML + private void communityMapScene() { + switchScene("CommunityMaps"); + } + + @FXML + private void updateMapScene() { + try { + parent.getScene().setRoot(FXMLLoader.load(Objects.requireNonNull(getClass().getResource("/fxml/PlayerCreateScene.fxml")))); + MusicPlayerSingleton.getInstance().getMediaPlayer().dispose(); + } catch (IOException e) { + throw new RuntimeException(); + } + } + + @FXML + private void backButton() { + switchScene("MainMenu"); + } + + private void switchScene(String name) { + parent.getChildren().clear(); + parent.getChildren().add(sceneLoader.loadScene(name)); + } +} diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/MenuBorderPaneController.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/MenuBorderPaneController.java index 6f980d5271853b580f31e74f3b3cac3ea1a9758d..81b05ca9a8de2670edb504e78a78fb3e20ca2ebd 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/MenuBorderPaneController.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/MenuBorderPaneController.java @@ -1,11 +1,15 @@ package de.hdm_stuttgart.battlearena.Controller; +import de.hdm_stuttgart.battlearena.Controller.Utilities.CreateMediaPlayer; +import de.hdm_stuttgart.battlearena.Controller.Utilities.MusicPlayerSingleton; +import de.hdm_stuttgart.battlearena.Controller.Utilities.SceneLoader; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.geometry.Rectangle2D; import javafx.scene.control.Button; import javafx.scene.image.ImageView; import javafx.scene.layout.BorderPane; +import javafx.scene.layout.StackPane; import javafx.scene.media.Media; import javafx.scene.media.MediaPlayer; import javafx.scene.media.MediaView; @@ -13,49 +17,91 @@ import javafx.stage.Screen; import java.io.File; import java.net.URL; -import java.util.ResourceBundle; +import java.util.*; public class MenuBorderPaneController implements Initializable { - // TODO: change FXML variables to private. Don't know why it's not working when they're private @FXML - public BorderPane parent; + private BorderPane parent; @FXML - public Button btnRight; + private Button btnRight, btnLeft; @FXML - public ImageView imgLeft, imgRight; - private int counter = 1; + private ImageView imgLeft, imgRight; + @FXML + private StackPane center; + private int musicCounter = 1, videoCounter = 0; private final SceneLoader sceneLoader = new SceneLoader(); - MediaPlayer musicPlayer; + private MediaPlayer musicPlayer, mediaPlayer; + private MediaView mediaView; + private final String[] videoFiles = {"depression", "allMyFellas", "wooOOoo", "myMind", "dogCheese", "gta", "cat", "bobama", "roomba", "firework", "cheezburger", + "kangaroo", "lifeCouldBeMonke", "seal", "imNotYou", "parkingTickets", "russianKid", "rejectHumanity", "horse", "catSitting", "pablo", "holyCrap", + "lessGoo", "sadCat", "basketball", "yoinkySploinky", "msPuff", "=D", "banana", "chaCha", "async", "sadHorse", "minecraftCat", "muecke", "top10Cats", "dog", + "pot", "mineCraftCat2", "catEating", "bear", "pancake", "frog", "gtfo", "carl", "dog2", "slippery", "wolf", "legCat", "sad", "waaahhh"}; + + List<String> shuffledVideos = Arrays.asList(videoFiles); + Rectangle2D screen = Screen.getPrimary().getVisualBounds(); @Override public void initialize(URL url, ResourceBundle resourceBundle) { - parent.setCenter(sceneLoader.loadScene("MainMenu")); + center.getChildren().add(sceneLoader.loadScene("MainMenu")); // set size for rusty gear image depending on screen resolution - Rectangle2D screen = Screen.getPrimary().getVisualBounds(); final double imageWidth = screen.getWidth() / 6; imgRight.setFitWidth(imageWidth); imgRight.setPreserveRatio(true); imgLeft.setFitWidth(imageWidth); imgLeft.setPreserveRatio(true); + backgroundMusic("cocBackgroundMusicTest.mp3"); + easterEgg(); + +// shuffle meme order + Collections.shuffle(shuffledVideos); } - public void easterEgg() { - btnRight.setOnMouseClicked(mouseEvent -> counter++); - switch (counter) { - case 5: - musicPlayer.dispose(); - backgroundMusic("spongeBob.mp3"); - break; - case 12: - musicPlayer.dispose(); - backgroundMusic("stadiumRave.mp3"); - break; - case 20: - musicPlayer.dispose(); - backgroundMusic("wii.mp3"); - break; - } + private void easterEgg() { + btnRight.setOnMouseClicked(mouseEvent -> { + System.out.println(center.getWidth()); + musicCounter++; + switch (musicCounter) { + case 5: + musicPlayer.dispose(); + backgroundMusic("spongeBob.mp3"); + break; + case 12: + musicPlayer.dispose(); + backgroundMusic("stadiumRave.mp3"); + break; + case 20: + musicPlayer.dispose(); + backgroundMusic("wii.mp3"); + break; + } + }); + + btnLeft.setOnMouseClicked(mouseEvent -> { +// make background music continue play after there is no meme left + if (!musicPlayer.isAutoPlay()) { + musicPlayer.play(); + } + +// if a meme is already running, current mediaPlayer will be removed + if (mediaPlayer != null) { + mediaPlayer.dispose(); + center.getChildren().remove(mediaView); + } + + if (videoCounter < videoFiles.length) { + String nextVideo = shuffledVideos.get(videoCounter); + musicPlayer.stop(); + mediaPlayer = new CreateMediaPlayer().getMediaPlayer(mediaView, new File("src/main/resources/videos/" + nextVideo + ".mp4"), false); + mediaView = new MediaView(mediaPlayer); + center.getChildren().add(mediaView); + mediaPlayer.setOnEndOfMedia(() -> { + center.getChildren().remove(mediaView); + musicPlayer.play(); + }); + } + videoCounter++; + }); } private void backgroundMusic(String file) { diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/MultiplayerController.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/MultiplayerController.java index c0398758ef90f8af93860a24e7706c04f3293035..181688fec0dda599c2b0f7e6b08177dc93913e80 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/MultiplayerController.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/MultiplayerController.java @@ -1,24 +1,31 @@ package de.hdm_stuttgart.battlearena.Controller; +import de.hdm_stuttgart.battlearena.Controller.Utilities.SceneLoader; import javafx.fxml.FXML; import javafx.scene.layout.VBox; public class MultiplayerController { - @FXML public VBox parent; + @FXML + private VBox parent; private final SceneLoader sceneLoader = new SceneLoader(); - public void multiplayerCreateScene() { - parent.getChildren().clear(); - parent.getChildren().add(sceneLoader.loadScene("MultiplayerCreate")); + @FXML + private void multiplayerCreateScene() { + switchScene("MultiplayerCreate"); } - public void multiplayerJoinScene() { - parent.getChildren().clear(); - parent.getChildren().add(sceneLoader.loadScene("MultiplayerJoin")); + @FXML + private void multiplayerJoinScene() { + switchScene("MultiplayerJoin"); + } + + @FXML + private void backButton() { + switchScene("Play"); } - public void playScene() { + private void switchScene(String name) { parent.getChildren().clear(); - parent.getChildren().add(sceneLoader.loadScene("Play")); + parent.getChildren().add(sceneLoader.loadScene(name)); } } diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/MultiplayerCreateController.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/MultiplayerCreateController.java index 3791d1b65442c4156ceed67abdabcd15d0459d64..6db97dfe730df0204ee53741f896e596fce5ebfe 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/MultiplayerCreateController.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/MultiplayerCreateController.java @@ -1,13 +1,16 @@ package de.hdm_stuttgart.battlearena.Controller; +import de.hdm_stuttgart.battlearena.Controller.Utilities.SceneLoader; import javafx.fxml.FXML; import javafx.scene.layout.VBox; public class MultiplayerCreateController { - @FXML public VBox parent; + @FXML + private VBox parent; private final SceneLoader sceneLoader = new SceneLoader(); - public void multiplayerScene() { + @FXML + private void backButton() { parent.getChildren().clear(); parent.getChildren().add(sceneLoader.loadScene("Multiplayer")); } diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/MultiplayerJoinController.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/MultiplayerJoinController.java index e6acf0f92a50714ee0e1a152a24ea0b6999ada31..0aefd1003845e6971d2a025ba5d13c48cf257a33 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/MultiplayerJoinController.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/MultiplayerJoinController.java @@ -1,13 +1,16 @@ package de.hdm_stuttgart.battlearena.Controller; +import de.hdm_stuttgart.battlearena.Controller.Utilities.SceneLoader; import javafx.fxml.FXML; import javafx.scene.layout.VBox; public class MultiplayerJoinController { - @FXML public VBox parent; + @FXML + private VBox parent; private final SceneLoader sceneLoader = new SceneLoader(); - public void multiplayerScene() { + @FXML + private void backButton() { parent.getChildren().clear(); parent.getChildren().add(sceneLoader.loadScene("Multiplayer")); } diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/OptionsController.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/OptionsController.java deleted file mode 100644 index 6cba2a46980f3f81abb00e59b69bb6b4666104f4..0000000000000000000000000000000000000000 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/OptionsController.java +++ /dev/null @@ -1,45 +0,0 @@ -package de.hdm_stuttgart.battlearena.Controller; - -import javafx.fxml.FXML; -import javafx.fxml.FXMLLoader; -import javafx.fxml.Initializable; -import javafx.scene.control.Slider; -import javafx.scene.layout.VBox; - -import java.io.IOException; -import java.net.URL; -import java.util.Objects; -import java.util.ResourceBundle; - -public class OptionsController implements Initializable { - @FXML public VBox parent; - @FXML public Slider volumeSlider; - SceneLoader sceneLoader = new SceneLoader(); - public double volume; - MusicPlayerSingleton musicPlayer = MusicPlayerSingleton.getInstance(); - - public void creditScene() throws IOException { - parent.getChildren().clear(); - parent.getScene().setRoot(FXMLLoader.load(Objects.requireNonNull(getClass().getResource("/fxml/credits.fxml")))); - } - - public void mainMenuScene() { - parent.getChildren().clear(); - parent.getChildren().add(sceneLoader.loadScene("MainMenu")); - } - - @Override - public void initialize(URL url, ResourceBundle resourceBundle) { - setVolume(); - } - - private void setVolume() { -// need a runtime database to save volume - volumeSlider.valueProperty().addListener((observableValue, oldValue, newValue) -> { - musicPlayer.getMediaPlayer().setVolume(volume); - volume = newValue.doubleValue() / 100; - musicPlayer.getMediaPlayer().setVolume(volume); - System.out.println(volume); - }); - } -} diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/PlayController.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/PlayController.java index 0b094a0e03c9fcf123fca334bd59b96f09bd719c..eae49e623cc42da45d01a9e19f7d0432c920ae59 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/PlayController.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/PlayController.java @@ -1,24 +1,31 @@ package de.hdm_stuttgart.battlearena.Controller; +import de.hdm_stuttgart.battlearena.Controller.Utilities.SceneLoader; import javafx.fxml.FXML; import javafx.scene.layout.VBox; public class PlayController { - @FXML public VBox parent; + @FXML + private VBox parent; private final SceneLoader sceneLoader = new SceneLoader(); - public void mainMenuScene() { - parent.getChildren().clear(); - parent.getChildren().add(sceneLoader.loadScene("MainMenu")); + @FXML + private void backButton() { + switchScene("MainMenu"); } - public void localScene() { - parent.getChildren().clear(); - parent.getChildren().add(sceneLoader.loadScene("LocalCreate")); + @FXML + private void localScene() { + switchScene("LocalCreate"); + } + + @FXML + private void multiplayerScene() { + switchScene("Multiplayer"); } - public void multiplayerScene() { + private void switchScene(String name) { parent.getChildren().clear(); - parent.getChildren().add(sceneLoader.loadScene("Multiplayer")); + parent.getChildren().add(sceneLoader.loadScene(name)); } } diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/PlayerCreateController.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/PlayerCreateController.java new file mode 100644 index 0000000000000000000000000000000000000000..68dfd4029aad7452c5d19d82fdfcaec3f0e8435e --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/PlayerCreateController.java @@ -0,0 +1,51 @@ +package de.hdm_stuttgart.battlearena.Controller; + +import de.hdm_stuttgart.battlearena.Controller.Utilities.CreateMediaPlayer; +import javafx.fxml.FXML; +import javafx.fxml.FXMLLoader; +import javafx.fxml.Initializable; +import javafx.scene.control.Button; +import javafx.scene.layout.BorderPane; +import javafx.scene.media.Media; +import javafx.scene.media.MediaPlayer; +import javafx.scene.media.MediaView; + +import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.util.Objects; +import java.util.ResourceBundle; + +public class PlayerCreateController implements Initializable { + @FXML + private BorderPane parent; + @FXML + private MediaView mediaView; + @FXML + private Button button; + private MediaPlayer mediaPlayer, musicPlayer; + + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + File file = new File("src/main/resources/videos/construction.mp4"); + mediaPlayer = new CreateMediaPlayer().getMediaPlayer(mediaView, file, true, parent); + mediaView.setMediaPlayer(mediaPlayer); + mediaPlayer.setCycleCount(MediaPlayer.INDEFINITE); + parent.setStyle("-fx-font-size: 50; -fx-text-fill: white; -fx-font-family: 'Arial Black'"); + + Media musicMedia = new Media(new File("src/main/resources/sound/music/constructionJazz.mp3").toURI().toString()); + musicPlayer = new MediaPlayer(musicMedia); + musicPlayer.setCycleCount(MediaPlayer.INDEFINITE); + musicPlayer.setAutoPlay(true); + + button.setOnMouseClicked(mouseEvent -> { + try { + mediaPlayer.dispose(); + musicPlayer.dispose(); + parent.getScene().setRoot(FXMLLoader.load(Objects.requireNonNull(getClass().getResource("/fxml/MenuBorderPane.fxml")))); + } catch (IOException e) { + throw new RuntimeException(); + } + }); + } +} diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/SettingsController.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/SettingsController.java new file mode 100644 index 0000000000000000000000000000000000000000..a3c7526665111d073af465d5c74599952442b63b --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/SettingsController.java @@ -0,0 +1,56 @@ +package de.hdm_stuttgart.battlearena.Controller; + +import de.hdm_stuttgart.battlearena.Controller.Utilities.MusicPlayerSingleton; +import de.hdm_stuttgart.battlearena.Controller.Utilities.SceneLoader; +import javafx.fxml.FXML; +import javafx.fxml.FXMLLoader; +import javafx.fxml.Initializable; +import javafx.scene.control.Slider; +import javafx.scene.layout.VBox; + +import java.io.IOException; +import java.net.URL; +import java.util.Objects; +import java.util.ResourceBundle; + +public class SettingsController implements Initializable { + @FXML + private VBox parent; + @FXML + private Slider musicVolume, sfxVolume; + SceneLoader sceneLoader = new SceneLoader(); + public double music; + MusicPlayerSingleton musicPlayer = MusicPlayerSingleton.getInstance(); + + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + setMusicVolume(); + } + + @FXML + private void creditScene() throws IOException { + parent.getChildren().clear(); + parent.getScene().setRoot(FXMLLoader.load(Objects.requireNonNull(getClass().getResource("/fxml/credits.fxml")))); + } + + @FXML + private void backButton() { + parent.getChildren().clear(); + parent.getChildren().add(sceneLoader.loadScene("MainMenu")); + } + + private void setMusicVolume() { +// need a runtime database to save volume + musicVolume.valueProperty().addListener((observableValue, oldValue, newValue) -> { + setMusic(musicVolume); + System.out.println(music); + }); + } + + private void setMusic(Slider slider) { + slider.valueProperty().addListener(((observableValue, oldValue, newValue) -> { + music = newValue.doubleValue() / 100; + musicPlayer.getMediaPlayer().setVolume(music); + })); + } +} diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/SkinSelectionController.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/SkinSelectionController.java index 531d6229fdfc5b15342a14f662977cecff1d4f2e..6015655a06d8dad0530362087a84c6e87e646f57 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/SkinSelectionController.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/SkinSelectionController.java @@ -1,11 +1,16 @@ package de.hdm_stuttgart.battlearena.Controller; +import de.hdm_stuttgart.battlearena.Controller.Utilities.MusicPlayerSingleton; +import de.hdm_stuttgart.battlearena.Controller.Utilities.SceneLoader; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; +import javafx.geometry.Rectangle2D; import javafx.scene.control.ToggleButton; import javafx.scene.control.ToggleGroup; +import javafx.scene.image.ImageView; import javafx.scene.layout.VBox; +import javafx.stage.Screen; import java.io.IOException; import java.net.URL; @@ -13,8 +18,12 @@ import java.util.Objects; import java.util.ResourceBundle; public class SkinSelectionController implements Initializable { - @FXML public VBox parent; - @FXML public ToggleGroup selectionButton; + @FXML + private VBox parent; + @FXML + private ToggleGroup selectionButton; + @FXML + private ImageView selection1, selection2, selection3; @Override public void initialize(URL url, ResourceBundle resourceBundle) { @@ -25,10 +34,26 @@ public class SkinSelectionController implements Initializable { System.out.println(value); } }); + setImageWidth(selection1, selection2, selection3); + } + private void setImageWidth(ImageView... imageViews) { // the ... allows for zero or more arguments seperated by a comma, will pass argument as an array + Rectangle2D screen = Screen.getPrimary().getVisualBounds(); + final double imageWidth = screen.getWidth() * 0.2; + for (ImageView image : imageViews) { + image.setFitWidth(imageWidth); + image.setPreserveRatio(true); + } + } + + @FXML + private void backButton() { + parent.getChildren().clear(); + parent.getChildren().add(new SceneLoader().loadScene("LocalCreate")); } - public void gameScene() { + @FXML + private void gameScene() { try { MusicPlayerSingleton.getInstance().getMediaPlayer().dispose(); parent.getScene().setRoot(FXMLLoader.load(Objects.requireNonNull(getClass().getResource("/fxml/GameScene.fxml")))); @@ -36,9 +61,4 @@ public class SkinSelectionController implements Initializable { throw new RuntimeException(); } } - - public void back() { - parent.getChildren().clear(); - parent.getChildren().add(new SceneLoader().loadScene("LocalCreate")); - } } diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/StatisticsController.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/StatisticsController.java index f591bfa15ef9a643f91fe59dc3c8c3482b085e8a..009c8a94b5f4a68c3c1b21ddcf194621be698a9c 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/StatisticsController.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/StatisticsController.java @@ -1,5 +1,6 @@ package de.hdm_stuttgart.battlearena.Controller; +import de.hdm_stuttgart.battlearena.Controller.Utilities.SceneLoader; import javafx.beans.binding.Bindings; import javafx.collections.FXCollections; import javafx.collections.ObservableList; @@ -14,9 +15,12 @@ import java.util.ResourceBundle; public class StatisticsController implements Initializable { - @FXML public Text blocks, deaths, gameTime, gamesLost, gamesWon, kills; - @FXML public VBox parent; - @FXML public PieChart kd, wl; + @FXML + private Text blocks, deaths, gameTime, gamesLost, gamesWon, kills; + @FXML + private VBox parent; + @FXML + private PieChart kd, wl; SceneLoader sceneLoader = new SceneLoader(); public void mainMenuScene() { @@ -24,36 +28,40 @@ public class StatisticsController implements Initializable { parent.getChildren().add(sceneLoader.loadScene("MainMenu")); } - public void initialize(URL url, ResourceBundle resourceBundle){ + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { iniPieChartkd(); iniPieChartwl(); + kd.setLegendVisible(false); + wl.setLegendVisible(false); } public void iniPieChartkd() { ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList( - new PieChart.Data("Kills",20), - new PieChart.Data("Deaths",12)); - - pieChartData.forEach(data -> - data.nameProperty().bind( - Bindings.concat( - data.getName(),": ", data.pieValueProperty() - ) - ) - ); - kd.getData().addAll(pieChartData); + new PieChart.Data("Kills", 20), + new PieChart.Data("Deaths", 12)); + + pieChartData.forEach(data -> + data.nameProperty().bind( + Bindings.concat( + data.getName(), ": ", data.pieValueProperty() + ) + ) + ); + kd.getData().addAll(pieChartData); } + public void iniPieChartwl() { ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList( - new PieChart.Data("Wins",3), - new PieChart.Data("Losses",5)); + new PieChart.Data("Wins", 3), + new PieChart.Data("Losses", 5)); pieChartData.forEach(data -> data.nameProperty().bind( Bindings.concat( - data.getName(),": ", data.pieValueProperty() + data.getName(), ": ", data.pieValueProperty() ) ) ); diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/ButtonTransition.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/Utilities/ButtonTransition.java similarity index 94% rename from src/main/java/de/hdm_stuttgart/battlearena/Controller/ButtonTransition.java rename to src/main/java/de/hdm_stuttgart/battlearena/Controller/Utilities/ButtonTransition.java index 2af6c6d63c35c91301dfd68eab22027ced9fdcbc..b129d469320cdd8549e234a3a5d6fae8901187ea 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/ButtonTransition.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/Utilities/ButtonTransition.java @@ -1,4 +1,4 @@ -package de.hdm_stuttgart.battlearena.Controller; +package de.hdm_stuttgart.battlearena.Controller.Utilities; import javafx.animation.ScaleTransition; import javafx.scene.control.Button; diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/CreateMediaPlayer.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/Utilities/CreateMediaPlayer.java similarity index 58% rename from src/main/java/de/hdm_stuttgart/battlearena/Controller/CreateMediaPlayer.java rename to src/main/java/de/hdm_stuttgart/battlearena/Controller/Utilities/CreateMediaPlayer.java index 03fbd835e1a457c5f9ad0fdd649d747840a240fd..4bf6c165db835d9908078118b40628cbfbc2350a 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/CreateMediaPlayer.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/Utilities/CreateMediaPlayer.java @@ -1,4 +1,4 @@ -package de.hdm_stuttgart.battlearena.Controller; +package de.hdm_stuttgart.battlearena.Controller.Utilities; import javafx.scene.layout.BorderPane; import javafx.scene.media.Media; @@ -8,15 +8,17 @@ import javafx.scene.media.MediaView; import java.io.File; public class CreateMediaPlayer { - public MediaPlayer getMediaPlayer(MediaView mediaView, File file, BorderPane parent) { + public MediaPlayer getMediaPlayer(MediaView mediaView, File file, boolean isFullscreen, BorderPane... parent) { Media media = new Media(file.toURI().toString()); MediaPlayer mediaPlayer = new MediaPlayer(media); // resizing once the scenes has been loaded to get width and height property - mediaPlayer.setOnReady(() -> { - mediaView.fitWidthProperty().bind(parent.getScene().widthProperty()); - mediaView.fitHeightProperty().bind(parent.getScene().heightProperty()); - }); + if (isFullscreen) { + mediaPlayer.setOnReady(() -> { + mediaView.fitWidthProperty().bind(parent[0].getScene().widthProperty()); + mediaView.fitHeightProperty().bind(parent[0].getScene().heightProperty()); + }); + } mediaPlayer.setAutoPlay(true); return mediaPlayer; } diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/MusicPlayerSingleton.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/Utilities/MusicPlayerSingleton.java similarity index 90% rename from src/main/java/de/hdm_stuttgart/battlearena/Controller/MusicPlayerSingleton.java rename to src/main/java/de/hdm_stuttgart/battlearena/Controller/Utilities/MusicPlayerSingleton.java index 5653a7c8cbca3e0278568d08fcda7dc7e1712c17..df8991982ff1b19ed4442b9e541b85b1d27397a4 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/MusicPlayerSingleton.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/Utilities/MusicPlayerSingleton.java @@ -1,4 +1,4 @@ -package de.hdm_stuttgart.battlearena.Controller; +package de.hdm_stuttgart.battlearena.Controller.Utilities; import javafx.scene.media.MediaPlayer; public class MusicPlayerSingleton { diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/SceneLoader.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/Utilities/SceneLoader.java similarity index 93% rename from src/main/java/de/hdm_stuttgart/battlearena/Controller/SceneLoader.java rename to src/main/java/de/hdm_stuttgart/battlearena/Controller/Utilities/SceneLoader.java index 0d5a04ef5789505821f173c05997a43313b8b33d..8c0e8b4a9487316777dd42b0823e07b737386208 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/SceneLoader.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/Utilities/SceneLoader.java @@ -1,4 +1,4 @@ -package de.hdm_stuttgart.battlearena.Controller; +package de.hdm_stuttgart.battlearena.Controller.Utilities; import javafx.fxml.FXMLLoader; import javafx.scene.layout.Pane; diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/Utilities/ScreenClasses.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/Utilities/ScreenClasses.java new file mode 100644 index 0000000000000000000000000000000000000000..469d628a724f3761c23b14fc85f602966e3d0720 --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/Utilities/ScreenClasses.java @@ -0,0 +1,28 @@ +package de.hdm_stuttgart.battlearena.Controller.Utilities; + +public enum ScreenClasses { +// enums have a range because the screen calculations are not precise, especially with screen scaling in the OS settings + INCH27(26, 28), + INCH24(23, 25), + INCH13_SURFACE(12, 14); + + final int lBound, uBound; + + ScreenClasses(int lBound, int uBound) { + this.lBound = lBound; + this.uBound = uBound; + } + + public static ScreenClasses inRange(int inches) { + for (ScreenClasses screens : ScreenClasses.values()) { + if (screens.isInRange(inches)) { + return screens; + } + } + return null; + } + + private boolean isInRange(int inches) { + return inches >= lBound && inches <= uBound; + } +} diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/Utilities/ScreenDimensionCalculator.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/Utilities/ScreenDimensionCalculator.java new file mode 100644 index 0000000000000000000000000000000000000000..4dee18cfe414ec04cc2323954e0ae0d77a128902 --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/Utilities/ScreenDimensionCalculator.java @@ -0,0 +1,12 @@ +package de.hdm_stuttgart.battlearena.Controller.Utilities; + +public class ScreenDimensionCalculator { + public double calculateDiagonalInches(double width, double height, double dpi) { + double diagonalPixels = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2)); + double diagonalInches = diagonalPixels / dpi; + System.out.println("diagonal pixels: " + diagonalPixels); + System.out.println("width: " + width); + System.out.println("height: " + height); + return diagonalInches; + } +} diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/ToggleButtonTransition.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/Utilities/ToggleButtonTransition.java similarity index 96% rename from src/main/java/de/hdm_stuttgart/battlearena/Controller/ToggleButtonTransition.java rename to src/main/java/de/hdm_stuttgart/battlearena/Controller/Utilities/ToggleButtonTransition.java index 6ee839dddf70e1a34ac776b9343e068234b391ab..94d51e4b2524cc0428678adadcf57b01e61dd643 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/ToggleButtonTransition.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/Utilities/ToggleButtonTransition.java @@ -1,4 +1,4 @@ -package de.hdm_stuttgart.battlearena.Controller; +package de.hdm_stuttgart.battlearena.Controller.Utilities; import javafx.animation.FadeTransition; import javafx.scene.control.ToggleButton; diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Main/Main.java b/src/main/java/de/hdm_stuttgart/battlearena/Main/Main.java index d222017ae825e1a18482ab3913991df51d2df7bf..5ba11eb60e0f13ae13883241d2a96279e5f58025 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Main/Main.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Main/Main.java @@ -6,6 +6,7 @@ import javafx.fxml.FXMLLoader; import javafx.geometry.Rectangle2D; import javafx.scene.Parent; import javafx.scene.Scene; +import javafx.scene.image.Image; import javafx.scene.text.Font; import javafx.stage.Screen; import javafx.stage.Stage; @@ -30,8 +31,9 @@ public class Main extends Application { @Override public void start(Stage stage) throws Exception { // loading font in start() because CSS can't handle whitespace in folder names - Font.loadFont(getClass().getResourceAsStream("/fonts/StarshipShadow.ttf"), 20); + Font.loadFont(getClass().getResourceAsStream("/fonts/StarshipShadow.ttf"), 50); +// TODO: revert back to intro scene Parent root = FXMLLoader.load(Objects.requireNonNull(getClass().getResource("/fxml/Intro.fxml"))); Scene scene = new Scene(root); @@ -40,6 +42,7 @@ public class Main extends Application { scene.setOnKeyReleased(inputHandler::handleKeyRelease); stage.setTitle("BattleArena"); + stage.getIcons().add(new Image("file:src/main/resources/textures/images/icon.png")); stage.setScene(scene); stage.minHeightProperty().setValue(400); stage.minWidthProperty().setValue(600); diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Model/DataStorage/Classes/RuntimeInfo.java b/src/main/java/de/hdm_stuttgart/battlearena/Model/DataStorage/Classes/RuntimeInfo.java index d533b9bbfc4a21084e875e9087a4718e5ad5cb81..4ed495708bd1d451811c1953ed80cb94b86610de 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Model/DataStorage/Classes/RuntimeInfo.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Model/DataStorage/Classes/RuntimeInfo.java @@ -1,8 +1,11 @@ package de.hdm_stuttgart.battlearena.Model.DataStorage.Classes; +import de.hdm_stuttgart.battlearena.Controller.Enum.GameMode; +import de.hdm_stuttgart.battlearena.Controller.Enum.GameState; import de.hdm_stuttgart.battlearena.Model.DataStorage.Classes.Exceptions.ParserException; import de.hdm_stuttgart.battlearena.Model.DataStorage.Classes.Utilities.HashGenerator; import de.hdm_stuttgart.battlearena.Model.DataStorage.Classes.Utilities.Parser; +import de.hdm_stuttgart.battlearena.Model.Entity.EntityClass; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -17,6 +20,13 @@ public class RuntimeInfo { protected MapData mapGame; protected boolean offlineMode; //if Account-Type is online but no SQL connection: start game without stats tracking + private GameState gameState = GameState.MENU; //Default value: MENU + private GameMode gameMode = GameMode.LOCAL; //Default value: LOCAL + + //Default value: HUMAN + private EntityClass playerOneClass = EntityClass.HUMAN; + private EntityClass playerTwoClass = EntityClass.HUMAN; + private RuntimeInfo(){}; @@ -50,4 +60,40 @@ public class RuntimeInfo { } } + public GameState getGameState() { + return gameState; + } + + public void setGameState(GameState gameState) { + this.gameState = gameState; + } + + public GameMode getGameMode() { + return gameMode; + } + + public void setGameMode(GameMode gameMode) { + this.gameMode = gameMode; + } + + public EntityClass getPlayerOneClass() { + return playerOneClass; + } + + public void setPlayerOneClass(EntityClass playerOneClass) { + this.playerOneClass = playerOneClass; + } + + public EntityClass getPlayerTwoClass() { + return playerTwoClass; + } + + public void setPlayerTwoClass(EntityClass playerTwoClass) { + this.playerTwoClass = playerTwoClass; + } + + public int gameTimeInHours(){ + return persistenceInst.getStatistics().getGameTime() / 3600; + } + } diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/EntityFactory.java b/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/EntityFactory.java index d5b4b382213c197e503a598e855940aa18821998..2e49bcaca57667a7fbea0431ff0fe8c91b356ac5 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/EntityFactory.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/EntityFactory.java @@ -1,5 +1,6 @@ package de.hdm_stuttgart.battlearena.Model.Entity; +import de.hdm_stuttgart.battlearena.Controller.Enum.PlayerMode; import de.hdm_stuttgart.battlearena.Controller.GameSceneController; import de.hdm_stuttgart.battlearena.Model.Inputs.InputHandler; @@ -12,13 +13,14 @@ public class EntityFactory { private static final Logger log = LogManager.getLogger(EntityFactory.class); - public static IEntity createEntity(EntityType entityType, GraphicsContext gameScene, InputHandler inputHandler, EntityClass entityClass, GameSceneController gameSceneController) { + public static IEntity createEntity(EntityType entityType, GraphicsContext gameScene, InputHandler inputHandler, + EntityClass entityClass, GameSceneController gameSceneController, PlayerMode playerMode) { if (entityType == EntityType.PLAYER) { log.debug("Entity " + entityType + " created"); - return new Player(gameScene, inputHandler, entityClass, gameSceneController); - } else if (entityType == EntityType.ENEMY_PLAYER) { + return new Player(gameScene, inputHandler, entityClass, gameSceneController, playerMode); + } else if (entityType == EntityType.NETWORK_PLAYER_TWO) { log.debug("Entity " + entityType + " created"); - return new EnemyHandler(); + return new NetworkPlayerTwo(); } throw new IllegalArgumentException ("Entity type not supported " + entityType); diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/EntityType.java b/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/EntityType.java index 3e8560772b2e9f049e217bdeca99c30c24150e11..108c4c2037dbcb53d090dc19a59b9b79450d6b68 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/EntityType.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/EntityType.java @@ -2,5 +2,6 @@ package de.hdm_stuttgart.battlearena.Model.Entity; public enum EntityType { PLAYER, - ENEMY_PLAYER + NETWORK_PLAYER_TWO, + LOKAL_PLAYER_TWO } \ No newline at end of file diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/IEntity.java b/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/IEntity.java index 92ca5b53906697c1bad96c2cbb59524b7bc2c40b..f98ddeb7452f60866c2dfe661dff29162c0004b7 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/IEntity.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/IEntity.java @@ -12,19 +12,23 @@ public interface IEntity { void updateEntityMovement(GameSceneController gameScene); + void checkHealTile(IEntity entity, GraphicsContext graphicsContext); + void attack(IEntity entity, GraphicsContext graphicsContext); void updateEntityWalkAnimation(); void renderEntity(GraphicsContext graphicsContext); - BoundingBox getBoxCollider(); + void healPlayer(int heal); + + BoundingBox getBoxCollider(); EntityDirection getEntityDirection(); int getEntitySpeed(); - int gotHit(int damageDone); + void gotHit(int damageDone); int getMapPosX(); diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/EnemyHandler.java b/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/NetworkPlayerTwo.java similarity index 75% rename from src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/EnemyHandler.java rename to src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/NetworkPlayerTwo.java index c8fc714cc5aa2eefe30e616b5211fe76e6457ff2..d045a108bf051f2e40573e084199808f2edbc630 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/EnemyHandler.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/NetworkPlayerTwo.java @@ -9,9 +9,9 @@ import javafx.scene.paint.Color; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; -class EnemyHandler implements IEntity{ +class NetworkPlayerTwo implements IEntity{ - private static final Logger log = LogManager.getLogger(EnemyHandler.class); + private static final Logger log = LogManager.getLogger(NetworkPlayerTwo.class); private final BoundingBox boxCollider = new BoundingBox(300, 200, 48, 48); @@ -36,6 +36,11 @@ class EnemyHandler implements IEntity{ } + @Override + public void checkHealTile(IEntity entity, GraphicsContext graphicsContext) { + + } + @Override public void attack(IEntity entity, GraphicsContext graphicsContext) { @@ -52,6 +57,12 @@ class EnemyHandler implements IEntity{ graphicsContext.fillRect(300, 200, 48, 48); } + @Override + public void healPlayer(int heal) { + log.info("Network player health: " + health); + health -= heal; + } + @Override public BoundingBox getBoxCollider() { return boxCollider; @@ -68,9 +79,9 @@ class EnemyHandler implements IEntity{ } @Override - public int gotHit(int damageDone) { - log.debug(health); - return health -= damageDone; + public void gotHit(int damageDone) { + log.debug("Network player health: " + health); + health -= damageDone; } @Override diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/Player.java b/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/Player.java index fffccf712e14e8a655bbc72622fae7e4c0d5d3b8..0eaf4b2ca5c23f540e284e5ef6e80bf1be36037f 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/Player.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/Player.java @@ -1,8 +1,10 @@ package de.hdm_stuttgart.battlearena.Model.Entity; +import de.hdm_stuttgart.battlearena.Controller.Enum.PlayerMode; import de.hdm_stuttgart.battlearena.Controller.GameSceneController; import de.hdm_stuttgart.battlearena.Model.Inputs.InputHandler; +import de.hdm_stuttgart.battlearena.Model.Map.TileManager; import javafx.geometry.BoundingBox; import javafx.scene.canvas.GraphicsContext; import javafx.scene.image.Image; @@ -16,6 +18,8 @@ class Player implements IEntity { private static final Logger log = LogManager.getLogger(Player.class); + private final PlayerMode PLAYER_MODE; + InputHandler inputHandler; CollisionHandler collisionHandler = new CollisionHandler(); @@ -51,17 +55,24 @@ class Player implements IEntity { private int mapPosX; private int mapPosY; + + private int lastMapPosX; + private int lastMapPosY; + private int playerSpeed; private EntityDirection playerDirection; - private int health = 10; - private int damage = 1; + private int health; + private int maxPlayerHealth; + private int damage; - public Player(GraphicsContext gameScene, InputHandler inputHandler, EntityClass entityClass, GameSceneController gameSceneController) { + public Player(GraphicsContext gameScene, InputHandler inputHandler, EntityClass entityClass, + GameSceneController gameSceneController, PlayerMode PLAYER_MODE) { this.gameScene = gameScene; this.inputHandler = inputHandler; this.entityClass = entityClass; this.gameSceneController = gameSceneController; + this.PLAYER_MODE = PLAYER_MODE; initializeEntity(); loadEntitySprites(); @@ -70,13 +81,45 @@ class Player implements IEntity { @Override public void initializeEntity() { scaledTileSize = gameSceneController.getScaledTileSize(); - mapPosX = 60; - mapPosY = 60; - boxCollider = new BoundingBox(mapPosX+15,mapPosY+10, playerWidth, playerHeight); - playerSpeed = 5; + if (PLAYER_MODE == PlayerMode.PLAYER_ONE) { + mapPosX = 60; + mapPosY = 60; + } else if (PLAYER_MODE == PlayerMode.PLAYER_TWO) { + mapPosX = 760; + mapPosY = 735; + } + + initializePlayerStats(); + + boxCollider = new BoundingBox(mapPosX + 15, mapPosY + 10, playerWidth, playerHeight); playerDirection = EntityDirection.DOWN; } + //Values result from balancing + private void initializePlayerStats() { + if (entityClass == EntityClass.HUMAN) { + maxPlayerHealth = 50; + health = 50; + damage = 5; + playerSpeed = 5; + } else if (entityClass == EntityClass.HIGH_BORN) { + maxPlayerHealth = 100; + health = 75; + damage = 2; + playerSpeed = 3; + } else if (entityClass == EntityClass.LOW_BORN) { + maxPlayerHealth = 10; + health = 10; + damage = 10; + playerSpeed = 7; + } else { + maxPlayerHealth = 40; + health = 15; + damage = 7; + playerSpeed = 5; + } + } + @Override public void loadEntitySprites() { try { @@ -99,19 +142,19 @@ class Player implements IEntity { } private void loadHumanSprites() { - directionDownOne = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/HumanDown01.png"))); - directionDownTwo = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/HumanDown02.png"))); - directionUpOne = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/upOne.png"))); - directionUpTwo = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/upTwo.png"))); - directionLeftOne = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/leftOne.png"))); - directionLeftTwo = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/leftTwo.png"))); - directionRightOne = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/rightOne.png"))); - directionRightTwo = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/rightTwo.png"))); + directionDownOne = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/human/HumanDown00.png"))); + directionDownTwo = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/human/HumanDown01.png"))); + directionUpOne = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/human/HumanUp00.png"))); + directionUpTwo = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/human/HumanUp01.png"))); + directionLeftOne = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/human/HumanLeft00.png"))); + directionLeftTwo = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/human/HumanLeft01.png"))); + directionRightOne = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/human/HumanRight00.png"))); + directionRightTwo = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/human/HumanRight01.png"))); } private void loadHighBornSprites() { - directionDownOne = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/HumanDown01.png"))); - directionDownTwo = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/HumanDown02.png"))); + directionDownOne = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/high_born/HighBornDown00.png"))); + directionDownTwo = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/high_born/HighBornDown01.png"))); directionUpOne = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/upOne.png"))); directionUpTwo = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/upTwo.png"))); directionLeftOne = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/leftOne.png"))); @@ -132,15 +175,15 @@ class Player implements IEntity { } private void loadSentinelsSprites() { - directionDownOne = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/HumanDown01.png"))); - directionDownTwo = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/HumanDown02.png"))); + directionDownOne = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/sentinels/SentinelDown00.png"))); + directionDownTwo = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/sentinels/SentinelDown01.png"))); directionUpOne = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/upOne.png"))); directionUpTwo = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/upTwo.png"))); directionLeftOne = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/leftOne.png"))); directionLeftTwo = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/leftTwo.png"))); directionRightOne = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/rightOne.png"))); directionRightTwo = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/player/rightTwo.png"))); - } + } private void loadWeaponSprites() { swordUp = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/weapons/SwordUp.png"))); @@ -151,57 +194,99 @@ class Player implements IEntity { @Override public void updateEntityMovement(GameSceneController gameScene) { - if (inputHandler.isMoveUp() || inputHandler.isMoveDown() || inputHandler.isMoveLeft() || inputHandler.isMoveRight()) { - if (inputHandler.isMoveUp()) { - playerDirection = EntityDirection.UP; - } else if (inputHandler.isMoveDown()) { - playerDirection = EntityDirection.DOWN; - } else if (inputHandler.isMoveLeft()) { - playerDirection = EntityDirection.LEFT; - } else { - playerDirection = EntityDirection.RIGHT; - } - - boolean isWalkableTile = collisionHandler.handleMapCollision(this, scaledTileSize, gameSceneController); - - int lastMapPosX = mapPosX; - int lastMapPosY = mapPosY; - - if (isWalkableTile) { - switch (playerDirection) { - case UP: - mapPosY -= playerSpeed; - break; - case DOWN: - mapPosY += playerSpeed; - break; - case LEFT: - mapPosX -= playerSpeed; - break; - case RIGHT: - mapPosX += playerSpeed; + if (PLAYER_MODE == PlayerMode.PLAYER_ONE) { + if (inputHandler.isMoveUp() || inputHandler.isMoveDown() || inputHandler.isMoveLeft() || inputHandler.isMoveRight()) { + if (inputHandler.isMoveUp()) { + playerDirection = EntityDirection.UP; + } else if (inputHandler.isMoveDown()) { + playerDirection = EntityDirection.DOWN; + } else if (inputHandler.isMoveLeft()) { + playerDirection = EntityDirection.LEFT; + } else if (inputHandler.isMoveRight()) { + playerDirection = EntityDirection.RIGHT; } - } - boolean isEntityCollision = boxCollider.intersects(gameScene.getEnemy().getBoxCollider()); - //boolean isEntityCollision = collisionHandler.handleBoxCollision(boxCollider, gameScene.getEnemy().getBoxCollider()); - - if (isEntityCollision) { - if (playerDirection == EntityDirection.UP) { - mapPosY = lastMapPosY + 30; - } else if (playerDirection == EntityDirection.DOWN) { - mapPosY = lastMapPosY - 30; - } else if (playerDirection == EntityDirection.LEFT) { - mapPosX = lastMapPosX + 30; - } else { - mapPosX = lastMapPosX - 30; + boolean isWalkableTile = collisionHandler.handleMapCollision(this, scaledTileSize, gameSceneController); + + performEntityMovement(isWalkableTile); + + boolean isEntityCollision = boxCollider.intersects(gameScene.getEnemy().getBoxCollider()); + //boolean isEntityCollision = collisionHandler.handleBoxCollision(boxCollider, gameScene.getEnemy().getBoxCollider()); + + performEntityCollision(isEntityCollision); + + updateEntityWalkAnimation(); + } + } else if (PLAYER_MODE == PlayerMode.PLAYER_TWO) { + if (inputHandler.isSdMoveUp() || inputHandler.isSdMoveDown() || inputHandler.isSdMoveLeft() || inputHandler.isSdMoveRight()) { + if (inputHandler.isSdMoveUp()) { + playerDirection = EntityDirection.UP; + } else if (inputHandler.isSdMoveDown()) { + playerDirection = EntityDirection.DOWN; + } else if (inputHandler.isSdMoveLeft()) { + playerDirection = EntityDirection.LEFT; + } else if (inputHandler.isSdMoveRight()) { + playerDirection = EntityDirection.RIGHT; } + + boolean isWalkableTile = collisionHandler.handleMapCollision(this, scaledTileSize, gameSceneController); + + performEntityMovement(isWalkableTile); + + boolean isEntityCollision = boxCollider.intersects(gameScene.getPlayer().getBoxCollider()); + //boolean isEntityCollision = collisionHandler.handleBoxCollision(boxCollider, gameScene.getEnemy().getBoxCollider()); + + performEntityCollision(isEntityCollision); + + updateEntityWalkAnimation(); } + } + } - boxCollider = new BoundingBox(mapPosX+15,mapPosY+10, playerWidth, playerHeight); + private void performEntityMovement(boolean isWalkableTile) { + lastMapPosX = mapPosX; + lastMapPosY = mapPosY; + + if (isWalkableTile) { + switch (playerDirection) { + case UP: + mapPosY -= playerSpeed; + break; + case DOWN: + mapPosY += playerSpeed; + break; + case LEFT: + mapPosX -= playerSpeed; + break; + case RIGHT: + mapPosX += playerSpeed; + } + } + } - updateEntityWalkAnimation(); + private void performEntityCollision(boolean isEntityCollision) { + if (isEntityCollision) { + if (playerDirection == EntityDirection.UP) { + mapPosY = lastMapPosY + 30; + } else if (playerDirection == EntityDirection.DOWN) { + mapPosY = lastMapPosY - 30; + } else if (playerDirection == EntityDirection.LEFT) { + mapPosX = lastMapPosX + 30; + } else { + mapPosX = lastMapPosX - 30; + } + } + boxCollider = new BoundingBox(mapPosX + 15, mapPosY + 10, playerWidth, playerHeight); + } + @Override + public void checkHealTile(IEntity entity, GraphicsContext graphicsContext){ + int xTile = entity.getMapPosX() / gameSceneController.getScaledTileSize(); + int yTile = entity.getMapPosY() / gameSceneController.getScaledTileSize(); + if(TileManager.tileMap[yTile][xTile +1 ] == 5){ + entity.healPlayer(1); + TileManager.tileMap[yTile][xTile +1] = 2; + log.info("Healed +1: " + health); } } @@ -209,47 +294,82 @@ class Player implements IEntity { public void attack(IEntity entity, GraphicsContext graphicsContext) { BoundingBox hitBox; + int xTile = mapPosX / gameSceneController.getScaledTileSize(); + int yTile = mapPosY / gameSceneController.getScaledTileSize(); + //log.info(xTile); + //log.info(yTile); + //int xTile = (int) (Math.random() * (18 - 1)); //Get xTile Coordinate +1 /-1 of playerTile + //int yTile = (int) (Math.random() * (18 - 1)); //Get yTile Coordinate +1 /-1 of playerTile + double dropChance = 0.5; + double randomDropChance = Math.random() * 1; + //log.info(randomDropChance); + //Added and subtracted numbers from variables are the pixel insets of the player sprite int attackRange = 30; int attackWidth = 10; - if (inputHandler.isAttack()){ + if (inputHandler.isAttack() && PLAYER_MODE == PlayerMode.PLAYER_ONE || + inputHandler.isSdAttack() && PLAYER_MODE == PlayerMode.PLAYER_TWO) { if (playerDirection == EntityDirection.UP) { - hitBox = new BoundingBox(mapPosX+playerWidth, mapPosY-10, attackWidth, attackRange); - graphicsContext.strokeRect(mapPosX+playerWidth, mapPosY-10, attackWidth, attackRange); - graphicsContext.drawImage(swordUp, mapPosX+8, mapPosY-10, 32, 32); + hitBox = new BoundingBox(mapPosX + playerWidth, mapPosY - 10, attackWidth, attackRange); + graphicsContext.strokeRect(mapPosX + playerWidth, mapPosY - 10, attackWidth, attackRange); + graphicsContext.drawImage(swordUp, mapPosX + 8, mapPosY - 10, 32, 32); if (hitBox.intersects(entity.getBoxCollider())) { entity.gotHit(damage); graphicsContext.strokeText("Hit", 10, 10); + + if (((TileManager.tileMap[xTile][yTile] == 3) && randomDropChance > dropChance)|| + ((TileManager.tileMap[xTile][yTile] == 1) && randomDropChance > dropChance)) + TileManager.tileMap[yTile-1][xTile+1] = 5; + //TileManager.tileMap[yTile-2][xTile] = 5; + //TileManager.tileMap[yTile-3][xTile] = 5; } } else if (playerDirection == EntityDirection.DOWN) { - hitBox = new BoundingBox(mapPosX+playerWidth, mapPosY+playerHeight, attackWidth, attackRange); - graphicsContext.strokeRect(mapPosX+playerWidth, mapPosY+playerHeight, attackWidth, attackRange); - graphicsContext.drawImage(swordDown, mapPosX+8, mapPosY+playerHeight, 32, 32); + hitBox = new BoundingBox(mapPosX + playerWidth, mapPosY + playerHeight, attackWidth, attackRange); + graphicsContext.strokeRect(mapPosX + playerWidth, mapPosY + playerHeight, attackWidth, attackRange); + graphicsContext.drawImage(swordDown, mapPosX + 8, mapPosY + playerHeight, 32, 32); if (hitBox.intersects(entity.getBoxCollider())) { entity.gotHit(damage); graphicsContext.strokeText("Hit", 10, 10); + + if (((TileManager.tileMap[xTile][yTile] == 3) && randomDropChance > dropChance)|| + ((TileManager.tileMap[xTile][yTile] == 1) && randomDropChance > dropChance)) + TileManager.tileMap[yTile-1][xTile+1] = 5; + //TileManager.tileMap[yTile-2][xTile] = 5; + //TileManager.tileMap[yTile-3][xTile] = 5; } } else if (playerDirection == EntityDirection.LEFT) { - hitBox = new BoundingBox(mapPosX-attackWidth, mapPosY+((double) playerHeight /2), + hitBox = new BoundingBox(mapPosX - attackWidth, mapPosY + ((double) playerHeight / 2), attackRange, attackWidth); - graphicsContext.strokeRect(mapPosX-attackWidth, mapPosY+((double) playerHeight /2), + graphicsContext.strokeRect(mapPosX - attackWidth, mapPosY + ((double) playerHeight / 2), attackRange, attackWidth); - graphicsContext.drawImage(swordLeft, mapPosX-8, mapPosY+8, 32, 32); + graphicsContext.drawImage(swordLeft, mapPosX - 8, mapPosY + 8, 32, 32); if (hitBox.intersects(entity.getBoxCollider())) { entity.gotHit(damage); graphicsContext.strokeText("Hit", 10, 10); + + if (((TileManager.tileMap[xTile][yTile] == 3) && randomDropChance > dropChance)|| + ((TileManager.tileMap[xTile][yTile] == 1) && randomDropChance > dropChance)) + TileManager.tileMap[yTile-1][xTile+1] = 5; + //TileManager.tileMap[yTile-2][xTile] = 5; + //TileManager.tileMap[yTile-3][xTile] = 5; } } else { - hitBox = new BoundingBox(mapPosX+playerWidth+attackWidth, mapPosY+((double) playerHeight /2), + hitBox = new BoundingBox(mapPosX + playerWidth + attackWidth, mapPosY + ((double) playerHeight / 2), attackRange, attackWidth); - graphicsContext.strokeRect(mapPosX+playerWidth+attackWidth, mapPosY+((double) playerHeight /2), + graphicsContext.strokeRect(mapPosX + playerWidth + attackWidth, mapPosY + ((double) playerHeight / 2), attackRange, attackWidth); - graphicsContext.drawImage(swordRight, mapPosX+playerWidth+8, mapPosY+8, 32, 32); + graphicsContext.drawImage(swordRight, mapPosX + playerWidth + 8, mapPosY + 8, 32, 32); if (hitBox.intersects(entity.getBoxCollider())) { entity.gotHit(damage); graphicsContext.strokeText("Hit", 10, 10); + + if (((TileManager.tileMap[xTile][yTile] == 3) && randomDropChance > dropChance)|| + ((TileManager.tileMap[xTile][yTile] == 1) && randomDropChance > dropChance)) + TileManager.tileMap[yTile-1][xTile+1] = 5; + //TileManager.tileMap[yTile-2][xTile] = 5; + //TileManager.tileMap[yTile-3][xTile] = 5; } } } @@ -274,7 +394,7 @@ class Player implements IEntity { Image playerSprite = null; //for debugging collision - graphicsContext.strokeRect(mapPosX+15,mapPosY+10, playerWidth, playerHeight); + graphicsContext.strokeRect(mapPosX + 15, mapPosY + 10, playerWidth, playerHeight); switch (playerDirection) { case UP: @@ -314,6 +434,22 @@ class Player implements IEntity { graphicsContext.drawImage(playerSprite, mapPosX, mapPosY, 48, 48); } + @Override + public void gotHit(int damageDone) { + health -= damageDone; + } + @Override + public void healPlayer(int healthRegenerated) { + int regeneratedHealth = health + healthRegenerated; + + if (regeneratedHealth < maxPlayerHealth) { + health += healthRegenerated; + } else { + health = maxPlayerHealth; + } + log.info(health); + } + @Override public BoundingBox getBoxCollider() { return boxCollider; @@ -329,11 +465,6 @@ class Player implements IEntity { return playerSpeed; } - @Override - public int gotHit(int damageDone) { - return health -= damageDone; - } - @Override public int getMapPosX() { return mapPosX; diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Model/Inputs/InputHandler.java b/src/main/java/de/hdm_stuttgart/battlearena/Model/Inputs/InputHandler.java index 8dfd2f3d3d51063e409488e71a25814030ed2f68..a66f47e852aac620010f786bbff62a0700292535 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Model/Inputs/InputHandler.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Model/Inputs/InputHandler.java @@ -18,26 +18,51 @@ public class InputHandler { return inputHandler; } + //Local Player/Player one controls private boolean moveUp, moveDown, moveLeft, moveRight, attack; + //Local player two controls + private boolean sdMoveUp, sdMoveDown, sdMoveLeft, sdMoveRight, sdAttack; + public void handleKeyPress(KeyEvent event) { KeyCode code = event.getCode(); switch (code) { case W: moveUp = true; + log.debug("Player move up"); break; case S: moveDown = true; + log.debug("Player move down"); break; case A: moveLeft = true; + log.debug("Player move left"); break; case D: moveRight = true; + log.debug("Player move right"); break; - case SPACE: + case E: attack = true; + log.debug("Player attack"); + break; + case UP: + sdMoveUp = true; + break; + case DOWN: + sdMoveDown = true; + break; + case LEFT: + sdMoveLeft = true; + break; + case RIGHT: + sdMoveRight = true; + break; + case MINUS: + sdAttack = true; + break; } } @@ -57,8 +82,24 @@ public class InputHandler { case D: moveRight = false; break; - case SPACE: + case E: attack = false; + break; + case UP: + sdMoveUp = false; + break; + case DOWN: + sdMoveDown = false; + break; + case LEFT: + sdMoveLeft = false; + break; + case RIGHT: + sdMoveRight = false; + break; + case MINUS: + sdAttack = false; + break; } } @@ -81,4 +122,24 @@ public class InputHandler { public boolean isAttack() { return attack; } + + public boolean isSdMoveUp() { + return sdMoveUp; + } + + public boolean isSdMoveDown() { + return sdMoveDown; + } + + public boolean isSdMoveLeft() { + return sdMoveLeft; + } + + public boolean isSdMoveRight() { + return sdMoveRight; + } + + public boolean isSdAttack() { + return sdAttack; + } } \ No newline at end of file diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/BackgroundTile.java b/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/BackgroundTile.java index c7fd6bc3ad273c2e2667a9398a33c94764947ea7..b17fb79d9742336e3d008bce528846433d1db394 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/BackgroundTile.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/BackgroundTile.java @@ -10,11 +10,12 @@ class BackgroundTile implements ITile{ private static final Logger log = LogManager.getLogger(BackgroundTile.class); private final Image tileSprite; - private final boolean isWalkable; + private final boolean isWalkable, isDestructible; - public BackgroundTile(Image tileSprite, boolean isWalkable) { + public BackgroundTile(Image tileSprite, boolean isWalkable, boolean isDestructible) { this.tileSprite = tileSprite; this.isWalkable = isWalkable; + this.isDestructible = isDestructible; } @Override @@ -22,6 +23,11 @@ class BackgroundTile implements ITile{ log.debug("Collision type: " + isWalkable + " returned."); return isWalkable; } + @Override + public boolean getDestruction() { + log.debug("Collision type: " + isDestructible + " returned."); + return isWalkable; + } @Override public Image getTileSprite() { diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/ITile.java b/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/ITile.java index f33750bed5ede99e059da2a7fb4e31f33bb735ad..58f711083e43f6be1046bd4d394adf7a3b6e8825 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/ITile.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/ITile.java @@ -4,5 +4,6 @@ import javafx.scene.image.Image; public interface ITile { boolean getCollision(); + boolean getDestruction(); Image getTileSprite(); } \ No newline at end of file diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/TileFactory.java b/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/TileFactory.java index 842781646eb4c59e1ba537d172414c7437b498b2..0da1a1558d0e6888a73fa456d3dd81f021d936fc 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/TileFactory.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/TileFactory.java @@ -9,13 +9,19 @@ public class TileFactory { private static final Logger log = LogManager.getLogger(TileFactory.class); - public static ITile createTile(TileType tileType, Image tileSprite) { - if (tileType == TileType.WALKABLE) { - log.debug("Tile with type: " + tileType + " created."); - return new BackgroundTile(tileSprite, true); - } else if (tileType == TileType.NON_WALKABLE) { - log.debug("Tile with type: " + tileType + " created."); - return new BackgroundTile(tileSprite, false); + public static ITile createTile(TileType tileType, TileType tileType2, Image tileSprite) { + if (tileType == TileType.WALKABLE && tileType2 == TileType.DESTRUCTIBLE) { + log.info("Tile with type: " + tileType + " " + tileType2 + " created."); + return new BackgroundTile(tileSprite, true, true); + }else if (tileType == TileType.WALKABLE && tileType2 == TileType.NON_DESTRUCTIBLE) { + log.info("Tile with type: " + tileType + " " + tileType2 +" created."); + return new BackgroundTile(tileSprite, true, false); + }else if (tileType == TileType.NON_WALKABLE && tileType2 == TileType.DESTRUCTIBLE) { + log.info("Tile with type: " + tileType + " " + tileType2 +" created."); + return new BackgroundTile(tileSprite, false, true); + }else if (tileType == TileType.NON_WALKABLE && tileType2 == TileType.NON_DESTRUCTIBLE) { + log.info("Tile with type: " + tileType + " " + tileType2 +" created."); + return new BackgroundTile(tileSprite, false, false); } log.error("TileType: " + tileType + " not supported!"); diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/TileManager.java b/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/TileManager.java index 480478d51823c0a4992de930e4eea5f2b73f82d8..0ac687dab223e1933fe99bbf42db3dfd3ed8b8b5 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/TileManager.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/TileManager.java @@ -14,7 +14,7 @@ public class TileManager { private final GraphicsContext graphicsContext2D; private final ITile[] tileSet; - private final int[][] tileMap; + public static int[][] tileMap; private final int horizontalTileCount; private final int verticalTileCount; @@ -34,16 +34,18 @@ public class TileManager { private void createTiles() { try { - tileSet[0] = TileFactory.createTile(TileType.WALKABLE, + tileSet[0] = TileFactory.createTile(TileType.WALKABLE, TileType.NON_DESTRUCTIBLE, new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/map/Grass01.png")))); - tileSet[1] = TileFactory.createTile(TileType.WALKABLE, + tileSet[1] = TileFactory.createTile(TileType.WALKABLE, TileType.NON_DESTRUCTIBLE, new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/map/Grass02.png")))); - tileSet[2] = TileFactory.createTile(TileType.WALKABLE, + tileSet[2] = TileFactory.createTile(TileType.WALKABLE, TileType.NON_DESTRUCTIBLE, new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/map/Grass04.png")))); - tileSet[3] = TileFactory.createTile(TileType.NON_WALKABLE, + tileSet[3] = TileFactory.createTile(TileType.NON_WALKABLE, TileType.DESTRUCTIBLE, new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/map/Stone01.png")))); - tileSet[4] = TileFactory.createTile(TileType.NON_WALKABLE, + tileSet[4] = TileFactory.createTile(TileType.NON_WALKABLE, TileType.DESTRUCTIBLE, new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/map/Stone02.png")))); + tileSet[5] = TileFactory.createTile(TileType.WALKABLE,TileType.NON_DESTRUCTIBLE, + new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/map/finalheart.png")))); } catch (Exception e) { log.error(e); } diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/TileType.java b/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/TileType.java index 17e95c7e93fc890a5f993cc53b7eb6cfd1f4bd6b..efe35788d26be5839df9efee6934ce54ec2c0d63 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/TileType.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/TileType.java @@ -2,5 +2,8 @@ package de.hdm_stuttgart.battlearena.Model.Map; public enum TileType { WALKABLE, - NON_WALKABLE + NON_WALKABLE, + DESTRUCTIBLE, + NON_DESTRUCTIBLE + } \ No newline at end of file diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 709ade468a755a08cdc96ccb0e622f9f5e6effc6..0aa585603d11693283af1248de569d8643ca3450 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -10,10 +10,16 @@ module gui { opens de.hdm_stuttgart.battlearena to javafx.fxml; + opens de.hdm_stuttgart.battlearena.Controller to javafx.fxml; opens de.hdm_stuttgart.battlearena.Model.DataStorage.Classes to com.google.gson; opens de.hdm_stuttgart.battlearena.Model.DataStorage.Classes.Exceptions to com.google.gson; opens de.hdm_stuttgart.battlearena.Model.DataStorage.Classes.Utilities to com.google.gson; exports de.hdm_stuttgart.battlearena.Main; exports de.hdm_stuttgart.battlearena.Controller; + exports de.hdm_stuttgart.battlearena.Model.Entity; + exports de.hdm_stuttgart.battlearena.Model.Inputs; + exports de.hdm_stuttgart.battlearena.Model.Map; + exports de.hdm_stuttgart.battlearena.Controller.Utilities; exports de.hdm_stuttgart.battlearena.Model.Multiplayer; -} + opens de.hdm_stuttgart.battlearena.Controller.Utilities to javafx.fxml; +} \ No newline at end of file diff --git a/src/main/resources/fxml/CommunityMaps.fxml b/src/main/resources/fxml/CommunityMaps.fxml new file mode 100644 index 0000000000000000000000000000000000000000..4c421873024cca71de548b0cf6ba3498472f6594 --- /dev/null +++ b/src/main/resources/fxml/CommunityMaps.fxml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.control.Button?> +<?import javafx.scene.control.TableColumn?> +<?import javafx.scene.control.TableView?> +<?import javafx.scene.layout.HBox?> +<?import javafx.scene.layout.VBox?> + +<VBox fx:id="parent" alignment="CENTER" prefHeight="400.0" prefWidth="600.0" stylesheets="@../styles/style.css" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hdm_stuttgart.battlearena.Controller.CommunityMapController"> + <children> + <TableView fx:id="tableView" editable="true" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" VBox.vgrow="ALWAYS"> + <columns> + <TableColumn editable="false" prefWidth="75.0" text="ID" /> + <TableColumn fx:id="name" editable="false" prefWidth="75.0" text="Name" /> + <TableColumn editable="false" prefWidth="75.0" text="Width" /> + <TableColumn editable="false" prefWidth="75.0" text="Height" /> + <TableColumn editable="false" prefWidth="75.0" text="Downloads" /> + </columns> + <columnResizePolicy> + <TableView fx:constant="CONSTRAINED_RESIZE_POLICY" /> + </columnResizePolicy> + </TableView> + <HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" spacing="20.0" VBox.vgrow="ALWAYS"> + <children> + <Button mnemonicParsing="false" onAction="#backButton" text="Back" /> + <Button mnemonicParsing="false" text="Load" /> + </children> + </HBox> + </children> +</VBox> diff --git a/src/main/resources/fxml/LocalCreate.fxml b/src/main/resources/fxml/LocalCreate.fxml index 46cca9f8e1e83c60b4a7c8cbc9753d9083bee1a0..f100d9b68a8eab3fc0d6554e02f8cbd29cd16373 100644 --- a/src/main/resources/fxml/LocalCreate.fxml +++ b/src/main/resources/fxml/LocalCreate.fxml @@ -4,7 +4,9 @@ <?import javafx.scene.control.Accordion?> <?import javafx.scene.control.Button?> <?import javafx.scene.control.RadioButton?> +<?import javafx.scene.control.ScrollPane?> <?import javafx.scene.control.TitledPane?> +<?import javafx.scene.control.ToggleButton?> <?import javafx.scene.control.ToggleGroup?> <?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.HBox?> @@ -14,15 +16,33 @@ <VBox fx:id="parent" alignment="CENTER" prefHeight="400.0" prefWidth="600.0" spacing="20.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hdm_stuttgart.battlearena.Controller.LocalCreateController"> <children> + <Pane VBox.vgrow="ALWAYS" /> <HBox alignment="TOP_CENTER" spacing="20.0"> <children> <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Rounds:" /> <Accordion> <panes> - <TitledPane animated="false" text="untitled 1"> - <content> - <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" /> - </content> + <TitledPane fx:id="roundsTitledPane" text="Select"> + <content> + <ScrollPane minViewportHeight="40.0"> + <content> + <VBox fx:id="boxBox"> + <children> + <ToggleButton mnemonicParsing="false" styleClass="roundsButton" text="1"> + <toggleGroup> + <ToggleGroup fx:id="rounds" /> + </toggleGroup> + <VBox.margin> + <Insets /> + </VBox.margin> + </ToggleButton> + <ToggleButton mnemonicParsing="false" styleClass="roundsButton" text="2" toggleGroup="$rounds" /> + <ToggleButton mnemonicParsing="false" styleClass="roundsButton" text="3" toggleGroup="$rounds" /> + </children> + </VBox> + </content> + </ScrollPane> + </content> </TitledPane> </panes> </Accordion> @@ -36,7 +56,7 @@ <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Time:" /> <Accordion> <panes> - <TitledPane animated="false" text="untitled 1"> + <TitledPane animated="false" text="Select"> <content> <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" /> </content> @@ -47,7 +67,7 @@ </HBox> <HBox alignment="TOP_CENTER" spacing="10.0"> <children> - <Text strokeType="OUTSIDE" strokeWidth="0.0" text="PLayers:" /> + <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Players:" /> <RadioButton mnemonicParsing="false" selected="true" text="2"> <toggleGroup> <ToggleGroup fx:id="group31" /> @@ -91,12 +111,11 @@ </children> </HBox> <Button mnemonicParsing="false" onAction="#skinSelectionScene" text="Start" /> - <Button mnemonicParsing="false" onAction="#playScene" text="Back"> + <Button mnemonicParsing="false" onAction="#backButton" text="Back"> <VBox.margin> <Insets bottom="50.0" /> </VBox.margin> </Button> <Pane VBox.vgrow="ALWAYS" /> - <Pane VBox.vgrow="ALWAYS" /> </children> </VBox> diff --git a/src/main/resources/fxml/MainMenu.fxml b/src/main/resources/fxml/MainMenu.fxml index 385eeb92c0ed4cce0d84e17363a2007d4a6c648b..39b45c2b7b94147fc779dda696f89e11fafa9e44 100644 --- a/src/main/resources/fxml/MainMenu.fxml +++ b/src/main/resources/fxml/MainMenu.fxml @@ -15,9 +15,9 @@ <Insets top="20.0" /> </VBox.margin> </Button> - <Button mnemonicParsing="false" text="Map Creator" VBox.vgrow="ALWAYS" /> + <Button mnemonicParsing="false" onAction="#mapScene" text="Map Forge" VBox.vgrow="ALWAYS" /> <Button mnemonicParsing="false" onAction="#statisticsScene" text="Statistics" VBox.vgrow="ALWAYS" /> - <Button mnemonicParsing="false" onAction="#optionsScene" text="Options" /> + <Button mnemonicParsing="false" onAction="#settingsScene" text="Settings" /> <Button fx:id="exitButton" alignment="CENTER" mnemonicParsing="false" onAction="#exit" text="Exit" /> <Pane VBox.vgrow="ALWAYS" /> <Pane layoutX="10.0" layoutY="395.0" VBox.vgrow="ALWAYS" /> diff --git a/src/main/resources/fxml/MapForge.fxml b/src/main/resources/fxml/MapForge.fxml new file mode 100644 index 0000000000000000000000000000000000000000..3c5265a067cce738ee950498e6b592adee6cb6d8 --- /dev/null +++ b/src/main/resources/fxml/MapForge.fxml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.control.Button?> +<?import javafx.scene.layout.Pane?> +<?import javafx.scene.layout.VBox?> + +<VBox fx:id="parent" alignment="CENTER" prefHeight="400.0" prefWidth="600.0" spacing="50.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hdm_stuttgart.battlearena.Controller.MapForgeController"> + <children> + <Pane VBox.vgrow="ALWAYS" /> + <Button mnemonicParsing="false" onAction="#mapEditorScene" text="Map Editor" /> + <Button mnemonicParsing="false" onAction="#communityMapScene" text="Community Maps" /> + <Button mnemonicParsing="false" onAction="#updateMapScene" text="Update Core Maps" /> + <Button mnemonicParsing="false" onAction="#backButton" text="Back" /> + <Pane VBox.vgrow="ALWAYS" /> + <Pane VBox.vgrow="ALWAYS" /> + </children> +</VBox> diff --git a/src/main/resources/fxml/MenuBorderPane.fxml b/src/main/resources/fxml/MenuBorderPane.fxml index 3d57e01ff6b3502f741c6c780cf56e6c04bf6419..ed87f4119563968953eef9ff3013783e8ce18a5e 100644 --- a/src/main/resources/fxml/MenuBorderPane.fxml +++ b/src/main/resources/fxml/MenuBorderPane.fxml @@ -4,10 +4,12 @@ <?import javafx.scene.image.Image?> <?import javafx.scene.image.ImageView?> <?import javafx.scene.layout.BorderPane?> +<?import javafx.scene.layout.StackPane?> +<?import javafx.scene.text.Font?> <BorderPane id="mainMenu" fx:id="parent" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hdm_stuttgart.battlearena.Controller.MenuBorderPaneController"> <right> - <Button fx:id="btnRight" mnemonicParsing="false" onAction="#easterEgg" prefWidth="111.0" BorderPane.alignment="BOTTOM_CENTER"> + <Button fx:id="btnRight" mnemonicParsing="false" prefWidth="111.0" BorderPane.alignment="BOTTOM_CENTER"> <graphic> <ImageView fx:id="imgRight" fitHeight="845.0" fitWidth="799.0" pickOnBounds="true" preserveRatio="true"> <image> @@ -18,7 +20,7 @@ </Button> </right> <left> - <Button mnemonicParsing="false" BorderPane.alignment="BOTTOM_CENTER"> + <Button fx:id="btnLeft" contentDisplay="TOP" mnemonicParsing="false" text=":)" BorderPane.alignment="BOTTOM_CENTER"> <graphic> <ImageView fx:id="imgLeft" fitHeight="904.0" fitWidth="856.0" pickOnBounds="true" preserveRatio="true"> <image> @@ -26,6 +28,12 @@ </image> </ImageView> </graphic> + <font> + <Font name="System Bold" size="30.0" /> + </font> </Button> </left> + <center> + <StackPane fx:id="center" BorderPane.alignment="CENTER" /> + </center> </BorderPane> diff --git a/src/main/resources/fxml/Multiplayer.fxml b/src/main/resources/fxml/Multiplayer.fxml index 690769c28f168b253fbfe41f6e5e559e0decc270..6746b48025b1335c72d967e59be21c3a22fd70fb 100644 --- a/src/main/resources/fxml/Multiplayer.fxml +++ b/src/main/resources/fxml/Multiplayer.fxml @@ -5,10 +5,9 @@ <?import javafx.scene.layout.Pane?> <?import javafx.scene.layout.VBox?> - <VBox fx:id="parent" alignment="CENTER" prefHeight="400.0" prefWidth="600.0" spacing="50.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hdm_stuttgart.battlearena.Controller.MultiplayerController"> <children> - <Pane maxHeight="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" /> + <Pane VBox.vgrow="ALWAYS" /> <Button mnemonicParsing="false" onAction="#multiplayerCreateScene" text="Create" VBox.vgrow="ALWAYS"> <VBox.margin> <Insets top="20.0" /> @@ -16,10 +15,10 @@ </Button> <Button mnemonicParsing="false" onAction="#multiplayerJoinScene" text="Join" VBox.vgrow="ALWAYS"> <VBox.margin> - <Insets bottom="50.0" /> + <Insets /> </VBox.margin> </Button> - <Button alignment="CENTER" mnemonicParsing="false" onAction="#playScene" text="Back"> + <Button alignment="CENTER" mnemonicParsing="false" onAction="#backButton" text="Back"> <VBox.margin> <Insets /> </VBox.margin> diff --git a/src/main/resources/fxml/MultiplayerCreate.fxml b/src/main/resources/fxml/MultiplayerCreate.fxml index b0909c0079e798d74543c95dfcb6c6f19d6cf72e..3cf21a91e290fca2da1b2516320c1feb50a99cee 100644 --- a/src/main/resources/fxml/MultiplayerCreate.fxml +++ b/src/main/resources/fxml/MultiplayerCreate.fxml @@ -10,7 +10,6 @@ <?import javafx.scene.layout.VBox?> <?import javafx.scene.text.Text?> - <VBox fx:id="parent" alignment="CENTER" prefHeight="400.0" prefWidth="600.0" spacing="20.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hdm_stuttgart.battlearena.Controller.MultiplayerCreateController"> <children> <Pane VBox.vgrow="ALWAYS" /> @@ -49,7 +48,7 @@ </VBox.margin> </AnchorPane> <Button mnemonicParsing="false" text="Start" /> - <Button mnemonicParsing="false" onAction="#multiplayerScene" text="Back" /> + <Button mnemonicParsing="false" onAction="#backButton" text="Back" /> <Pane VBox.vgrow="ALWAYS" /> <Pane VBox.vgrow="ALWAYS" /> </children> diff --git a/src/main/resources/fxml/MultiplayerJoin.fxml b/src/main/resources/fxml/MultiplayerJoin.fxml index e8a48e621d53819dee9b9bf53b9440b4bbd1bb9a..117cf38cd7ba79fb3f41209f4a4b869e4a11e889 100644 --- a/src/main/resources/fxml/MultiplayerJoin.fxml +++ b/src/main/resources/fxml/MultiplayerJoin.fxml @@ -6,7 +6,6 @@ <?import javafx.scene.layout.VBox?> <?import javafx.scene.text.Text?> - <VBox fx:id="parent" alignment="CENTER" prefHeight="400.0" prefWidth="600.0" spacing="50.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hdm_stuttgart.battlearena.Controller.MultiplayerJoinController"> <children> <Pane maxHeight="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" /> @@ -15,7 +14,7 @@ <Button mnemonicParsing="false" text="Connect" VBox.vgrow="ALWAYS" /> <Text strokeType="OUTSIDE" strokeWidth="0.0" text="[Error Message]" /> <Pane maxHeight="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" /> - <Button alignment="CENTER" mnemonicParsing="false" onAction="#multiplayerScene" text="Back" /> + <Button alignment="CENTER" mnemonicParsing="false" onAction="#backButton" text="Back" /> <Pane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="20.0" VBox.vgrow="ALWAYS" /> </children> </VBox> diff --git a/src/main/resources/fxml/Options.fxml b/src/main/resources/fxml/Options.fxml deleted file mode 100644 index 79f14cd61fc942bff138bc3a22443bdf8f9ef2a0..0000000000000000000000000000000000000000 --- a/src/main/resources/fxml/Options.fxml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<?import javafx.scene.control.Button?> -<?import javafx.scene.control.Slider?> -<?import javafx.scene.layout.HBox?> -<?import javafx.scene.layout.VBox?> -<?import javafx.scene.text.Text?> - - -<VBox fx:id="parent" alignment="CENTER" prefHeight="400.0" prefWidth="600.0" spacing="20.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hdm_stuttgart.battlearena.Controller.OptionsController"> - <children> - <HBox alignment="CENTER"> - <children> - <VBox alignment="TOP_CENTER" spacing="10.0"> - <children> - <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Volume:" /> - <Slider fx:id="volumeSlider" blockIncrement="25.0" majorTickUnit="100.0" minorTickCount="1" prefHeight="14.0" prefWidth="480.0" showTickLabels="true" value="75.0" VBox.vgrow="NEVER" /> - </children> - </VBox> - </children> - </HBox> - <Button mnemonicParsing="false" onAction="#creditScene" text="Credits" /> - <Button mnemonicParsing="false" onAction="#mainMenuScene" text="Back" /> - </children> -</VBox> diff --git a/src/main/resources/fxml/Play.fxml b/src/main/resources/fxml/Play.fxml index 1cdd69e375cc8a700854d3e66b5caa1a8b9d6ad7..a4cbce23e49949a94521f25dd1b898423ae67e2a 100644 --- a/src/main/resources/fxml/Play.fxml +++ b/src/main/resources/fxml/Play.fxml @@ -4,13 +4,12 @@ <?import javafx.scene.layout.Pane?> <?import javafx.scene.layout.VBox?> - <VBox fx:id="parent" alignment="CENTER" prefHeight="400.0" prefWidth="600.0" spacing="20.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hdm_stuttgart.battlearena.Controller.PlayController"> <children> <Pane VBox.vgrow="ALWAYS" /> <Button mnemonicParsing="false" onAction="#localScene" text="Local" /> <Button mnemonicParsing="false" onAction="#multiplayerScene" text="Multiplayer" /> - <Button alignment="CENTER" mnemonicParsing="false" onAction="#mainMenuScene" text="Back" /> + <Button alignment="CENTER" mnemonicParsing="false" onAction="#backButton" text="Back" /> <Pane VBox.vgrow="ALWAYS" /> <Pane VBox.vgrow="ALWAYS" /> </children> diff --git a/src/main/resources/fxml/PlayerCreateScene.fxml b/src/main/resources/fxml/PlayerCreateScene.fxml new file mode 100644 index 0000000000000000000000000000000000000000..1563facf396815b701f237fdab3dd7e3769c7951 --- /dev/null +++ b/src/main/resources/fxml/PlayerCreateScene.fxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.control.Button?> +<?import javafx.scene.layout.BorderPane?> +<?import javafx.scene.layout.StackPane?> +<?import javafx.scene.layout.VBox?> +<?import javafx.scene.media.MediaView?> +<?import javafx.scene.text.Text?> + + +<BorderPane fx:id="parent" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hdm_stuttgart.battlearena.Controller.PlayerCreateController"> + <center> + <StackPane BorderPane.alignment="CENTER"> + <children> + <MediaView fx:id="mediaView" fitHeight="200.0" fitWidth="200.0" /> + <VBox alignment="CENTER" prefHeight="200.0" prefWidth="100.0" spacing="10.0"> + <children> + <Text fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="WELCOME!" /> + <Text fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="This page is still under construction" /> + <Text fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="please have some patience" /> + <Text fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="Thank you" /> + <Button fx:id="button" mnemonicParsing="false" text="Get me out of here" /> + </children> + </VBox> + </children> + </StackPane> + </center> +</BorderPane> diff --git a/src/main/resources/fxml/Settings.fxml b/src/main/resources/fxml/Settings.fxml new file mode 100644 index 0000000000000000000000000000000000000000..6cab6585ef8f19e015fc3645684934a599ee9aec --- /dev/null +++ b/src/main/resources/fxml/Settings.fxml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.control.Button?> +<?import javafx.scene.control.Slider?> +<?import javafx.scene.layout.HBox?> +<?import javafx.scene.layout.VBox?> +<?import javafx.scene.text.Text?> + +<VBox fx:id="parent" alignment="CENTER" prefHeight="400.0" prefWidth="600.0" spacing="20.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hdm_stuttgart.battlearena.Controller.SettingsController"> + <children> + <HBox alignment="CENTER"> + <children> + <VBox alignment="TOP_CENTER" spacing="10.0"> + <children> + <VBox alignment="CENTER" VBox.vgrow="ALWAYS"> + <children> + <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Music volume:" /> + <Slider fx:id="musicVolume" blockIncrement="25.0" majorTickUnit="100.0" minorTickCount="1" prefHeight="14.0" prefWidth="480.0" showTickLabels="true" value="75.0" VBox.vgrow="NEVER" /> + </children> + </VBox> + <VBox alignment="CENTER" VBox.vgrow="ALWAYS"> + <children> + <Text strokeType="OUTSIDE" strokeWidth="0.0" text="SFX volume:" /> + <Slider fx:id="sfxVolume" blockIncrement="25.0" majorTickUnit="100.0" minorTickCount="1" prefHeight="14.0" prefWidth="480.0" showTickLabels="true" value="75.0" /> + </children> + </VBox> + </children> + </VBox> + </children> + </HBox> + <Button mnemonicParsing="false" onAction="#creditScene" text="Credits" /> + <Button mnemonicParsing="false" onAction="#backButton" text="Back" /> + </children> +</VBox> diff --git a/src/main/resources/fxml/SkinSelection.fxml b/src/main/resources/fxml/SkinSelection.fxml index 97773771860f208bdfa49f51c5219c0e89e16ef3..b98b91af38434be6169c8cdfead739ef20587460 100644 --- a/src/main/resources/fxml/SkinSelection.fxml +++ b/src/main/resources/fxml/SkinSelection.fxml @@ -12,9 +12,9 @@ <children> <HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" spacing="40.0"> <children> - <ToggleButton contentDisplay="TOP" mnemonicParsing="false" text="Elias"> + <ToggleButton contentDisplay="TOP" mnemonicParsing="false" styleClass="skinSelection" text="Elias"> <graphic> - <ImageView fitHeight="700.0" fitWidth="700.0" pickOnBounds="true" preserveRatio="true"> + <ImageView fx:id="selection1" fitHeight="700.0" fitWidth="700.0" pickOnBounds="true" preserveRatio="true"> <image> <Image url="@../textures/images/elias.png" /> </image> @@ -24,18 +24,18 @@ <ToggleGroup fx:id="selectionButton" /> </toggleGroup> </ToggleButton> - <ToggleButton contentDisplay="TOP" mnemonicParsing="false" text="Erzan" toggleGroup="$selectionButton"> + <ToggleButton contentDisplay="TOP" mnemonicParsing="false" styleClass="skinSelection" text="Erzan" toggleGroup="$selectionButton"> <graphic> - <ImageView fitHeight="700.0" fitWidth="700.0" pickOnBounds="true" preserveRatio="true"> + <ImageView fx:id="selection2" fitHeight="700.0" fitWidth="700.0" pickOnBounds="true" preserveRatio="true"> <image> <Image url="@../textures/images/erzan.png" /> </image> </ImageView> </graphic> </ToggleButton> - <ToggleButton contentDisplay="TOP" mnemonicParsing="false" text="Martin" toggleGroup="$selectionButton"> + <ToggleButton contentDisplay="TOP" mnemonicParsing="false" styleClass="skinSelection" text="Martin" toggleGroup="$selectionButton"> <graphic> - <ImageView fitHeight="700.0" fitWidth="700.0" pickOnBounds="true" preserveRatio="true"> + <ImageView fx:id="selection3" fitHeight="700.0" fitWidth="700.0" pickOnBounds="true" preserveRatio="true"> <image> <Image url="@../textures/images/martin.png" /> </image> @@ -45,6 +45,6 @@ </children> </HBox> <Button mnemonicParsing="false" onAction="#gameScene" text="Start" /> - <Button mnemonicParsing="false" onAction="#back" text="Back" /> + <Button mnemonicParsing="false" onAction="#backButton" text="Back" /> </children> </VBox> diff --git a/src/main/resources/fxml/Statistics.fxml b/src/main/resources/fxml/Statistics.fxml index cb429d7b51d3d377a00e0495feee430c61cd7998..6c98b4e5e5aa7e8efd880b6945b8c7091aa04d32 100644 --- a/src/main/resources/fxml/Statistics.fxml +++ b/src/main/resources/fxml/Statistics.fxml @@ -7,10 +7,9 @@ <?import javafx.scene.layout.VBox?> <?import javafx.scene.text.Text?> - <VBox fx:id="parent" alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" spacing="50.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hdm_stuttgart.battlearena.Controller.StatisticsController"> <children> - <HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" spacing="30.0"> + <HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" spacing="30.0" VBox.vgrow="ALWAYS"> <children> <VBox alignment="CENTER_RIGHT" prefHeight="200.0" prefWidth="100.0" spacing="10.0" HBox.hgrow="ALWAYS"> <children> @@ -35,10 +34,16 @@ <Insets /> </HBox.margin> </VBox> - <VBox prefHeight="200.0" prefWidth="100.0"> + <VBox prefHeight="200.0" prefWidth="100.0" HBox.hgrow="ALWAYS"> <children> - <PieChart fx:id="kd" /> - <PieChart fx:id="wl" /> + <PieChart fx:id="kd" minHeight="-Infinity" minWidth="-Infinity" VBox.vgrow="ALWAYS"> + <VBox.margin> + <Insets bottom="-200.0" /> + </VBox.margin></PieChart> + <PieChart fx:id="wl" minHeight="-Infinity" minWidth="-Infinity" VBox.vgrow="ALWAYS"> + <VBox.margin> + <Insets top="-40.0" /> + </VBox.margin></PieChart> </children> </VBox> </children> diff --git a/src/main/resources/sound/music/cocBackgroundMusicTest.mp3 b/src/main/resources/sound/music/cocBackgroundMusicTest.mp3 index e916ecb6c0b6487e9bcb8ca6c3d54f6259eac9dc..fe39b45659600de8eb2ed2bdac281444be461261 100644 Binary files a/src/main/resources/sound/music/cocBackgroundMusicTest.mp3 and b/src/main/resources/sound/music/cocBackgroundMusicTest.mp3 differ diff --git a/src/main/resources/sound/music/constructionJazz.mp3 b/src/main/resources/sound/music/constructionJazz.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..5669e8017883014e447765a405c6ec3b208db5bb Binary files /dev/null and b/src/main/resources/sound/music/constructionJazz.mp3 differ diff --git a/src/main/resources/styles/style.css b/src/main/resources/styles/style.css index bb2a6b5c6f0ed83f68a407a24e34124a8caec3fe..2bb5cd89b79625f3392d4701dcf93ac9fb88d7f2 100644 --- a/src/main/resources/styles/style.css +++ b/src/main/resources/styles/style.css @@ -3,10 +3,13 @@ -fx-brown: #956233; } +#button { + -fx-text-fill: black; +} + .root { -fx-font-family: "Starship Shadow"; - -fx-text-fill: -fx-brown; - -fx-font-size: 50; + -fx-text-fill: white; -fx-background-color: black; } @@ -22,13 +25,75 @@ .button { -fx-text-fill: -fx-brown; -fx-background-color: none; - -fx-skin: "de.hdm_stuttgart.battlearena.Controller.ButtonTransition"; + -fx-skin: "de.hdm_stuttgart.battlearena.Controller.Utilities.ButtonTransition"; +} + +#btnLeft { + -fx-skin: none; + -fx-text-fill: white; } .accordion { -fx-font-size: 30; } +.titled-pane:focused > .title > .arrow-button > .arrow { + -fx-effect: null; +} + +.accordion .titled-pane > *.content{ + -fx-background-color: transparent ; + -fx-border-width: 0; +} + +.accordion .titled-pane > .title { + -fx-background-color: transparent; + -fx-border-width: 0; +} + +.scroll-pane > .viewport { + -fx-background-color: none; +} + +.scroll-pane { + -fx-background-color: transparent; +} + +/*scroll pane scroll bar*/ +.scroll-pane .scroll-bar:horizontal .track, +.scroll-pane .scroll-bar:vertical .track { + -fx-background-color: -fx-dark-brown; + -fx-border-color: none; + -fx-background-radius: 1em; + -fx-border-radius: 1em; +} + +/* The increment and decrement button CSS class of scrollbar */ +.scroll-pane .scroll-bar:vertical .increment-button , +.scroll-pane .scroll-bar:vertical .decrement-button { + -fx-background-color: transparent; + -fx-background-radius: 0em; + -fx-padding:0 12 0 0; +} + +.scroll-pane .scroll-bar .increment-arrow, +.scroll-pane .scroll-bar .decrement-arrow { + -fx-shape: " "; + -fx-padding: 0; +} + +/* The main scrollbar **thumb** CSS class which we drag every time (movable) */ +.scroll-pane .scroll-bar:horizontal .thumb, +.scroll-pane .scroll-bar:vertical .thumb { + -fx-background-color: white; + -fx-background-insets: 2, 0, 0; + -fx-background-radius: 1em; +} + +#boxBox { + -fx-background-color: none; +} + /* https://dx.dragan.ba/javafx-radiobutton-custom-css/ */ .radio-button .radio { -fx-border-width: 1px; @@ -49,7 +114,7 @@ } .slider .track { - -fx-background-color: rgba(0, 0, 0, 0.5); + -fx-background-color: rgba(0, 0, 0, 0.5); -fx-pref-height: 0.2em; } @@ -60,6 +125,60 @@ } .toggle-button { - -fx-skin: "de.hdm_stuttgart.battlearena.Controller.ToggleButtonTransition"; + -fx-skin: "de.hdm_stuttgart.battlearena.Controller.Utilities.ToggleButtonTransition"; -fx-background-color: none; } + +.skinSelection:pressed { + -fx-background-color: rgba(255, 255, 255, 0.3); +} + +.table-view { + -fx-background-color: transparent; +} + +.table-view .column-header { + -fx-background-color: -fx-brown; +} + +.table-view .table-cell{ + -fx-font-size: 30; + -fx-alignment: center; +} + +.table-row-cell { + -fx-background-color: rgba(0, 0, 0, 0.2); +} + +.table-row-cell:hover { + -fx-background-color: rgba(0, 0, 0, 0.1); +} + +.table-row-cell:selected { + -fx-background-color: rgba(255, 255, 255, 0.3); +} + +.chart { + -fx-pref-width: 600; + -fx-pref-height: 620; + -fx-min-width: 600; + -fx-min-height: 620; + -fx-max-width: 916; + -fx-max-height: 620; +} + +.chart-pie { + -fx-border-color: black; +} + +.chart-pie-label { + -fx-font-size: 0.7em; +} + +.chart-legend { + -fx-background-color: rgba(60, 32, 20, 0.2); +} + +.default-color0.chart-pie {-fx-pie-color: transparent;} +.default-color1.chart-pie {-fx-pie-color: transparent;} +.default-color2.chart-pie {-fx-pie-color: transparent;} diff --git a/src/main/resources/textures/images/background.png b/src/main/resources/textures/images/background.png index 67ec5faee876e21cc496b5a4a265deed0a14a7cf..cfecaea36ac9953b10720b8cee301e0501b75064 100644 Binary files a/src/main/resources/textures/images/background.png and b/src/main/resources/textures/images/background.png differ diff --git a/src/main/resources/textures/images/icon.png b/src/main/resources/textures/images/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ec952db144b1681f2e7ce5954f1ffaeda29fab71 Binary files /dev/null and b/src/main/resources/textures/images/icon.png differ diff --git a/src/main/resources/textures/map/finalheart.png b/src/main/resources/textures/map/finalheart.png new file mode 100644 index 0000000000000000000000000000000000000000..b861b145ceb949abdd7222a2679fe8e10756340f Binary files /dev/null and b/src/main/resources/textures/map/finalheart.png differ diff --git a/src/main/resources/textures/player/high_born/HighBornDown00.png b/src/main/resources/textures/player/high_born/HighBornDown00.png new file mode 100644 index 0000000000000000000000000000000000000000..b87b19b2ffe1ce2048c6d8bc96d1e4a66fd4c4af Binary files /dev/null and b/src/main/resources/textures/player/high_born/HighBornDown00.png differ diff --git a/src/main/resources/textures/player/high_born/HighBornDown01.png b/src/main/resources/textures/player/high_born/HighBornDown01.png new file mode 100644 index 0000000000000000000000000000000000000000..787b4603347dac4b2d5f2c1063b3e3a3551fed4a Binary files /dev/null and b/src/main/resources/textures/player/high_born/HighBornDown01.png differ diff --git a/src/main/resources/textures/player/human/HumanDown00.png b/src/main/resources/textures/player/human/HumanDown00.png new file mode 100644 index 0000000000000000000000000000000000000000..980612cb998a80e7710798fbd2f8a81791ef7322 Binary files /dev/null and b/src/main/resources/textures/player/human/HumanDown00.png differ diff --git a/src/main/resources/textures/player/human/HumanDown01.png b/src/main/resources/textures/player/human/HumanDown01.png new file mode 100644 index 0000000000000000000000000000000000000000..54792ff64f25e5c6e48e35f90502ff2d7fea9893 Binary files /dev/null and b/src/main/resources/textures/player/human/HumanDown01.png differ diff --git a/src/main/resources/textures/player/human/HumanLeft00.png b/src/main/resources/textures/player/human/HumanLeft00.png new file mode 100644 index 0000000000000000000000000000000000000000..2d259ebb0c88259967e361c93138dd3367bcfe1b Binary files /dev/null and b/src/main/resources/textures/player/human/HumanLeft00.png differ diff --git a/src/main/resources/textures/player/human/HumanLeft01.png b/src/main/resources/textures/player/human/HumanLeft01.png new file mode 100644 index 0000000000000000000000000000000000000000..3e25fce1c897aa94297d73248a54b1c09700d8d2 Binary files /dev/null and b/src/main/resources/textures/player/human/HumanLeft01.png differ diff --git a/src/main/resources/textures/player/human/HumanRight00.png b/src/main/resources/textures/player/human/HumanRight00.png new file mode 100644 index 0000000000000000000000000000000000000000..f20b2b692e98c68bc6671b0294a3582b4de65f0b Binary files /dev/null and b/src/main/resources/textures/player/human/HumanRight00.png differ diff --git a/src/main/resources/textures/player/human/HumanRight01.png b/src/main/resources/textures/player/human/HumanRight01.png new file mode 100644 index 0000000000000000000000000000000000000000..ba2dd289825604b6730186ffb862592b2d94bb12 Binary files /dev/null and b/src/main/resources/textures/player/human/HumanRight01.png differ diff --git a/src/main/resources/textures/player/human/HumanUp00.png b/src/main/resources/textures/player/human/HumanUp00.png new file mode 100644 index 0000000000000000000000000000000000000000..bf2042d6a68463fa8c392c03d5cfaa973f9d1ae4 Binary files /dev/null and b/src/main/resources/textures/player/human/HumanUp00.png differ diff --git a/src/main/resources/textures/player/human/HumanUp01.png b/src/main/resources/textures/player/human/HumanUp01.png new file mode 100644 index 0000000000000000000000000000000000000000..c21f00058a48f3c99b1eeaae7f2d93f8baef1471 Binary files /dev/null and b/src/main/resources/textures/player/human/HumanUp01.png differ diff --git a/src/main/resources/textures/player/sentinels/SentinelDown00.png b/src/main/resources/textures/player/sentinels/SentinelDown00.png new file mode 100644 index 0000000000000000000000000000000000000000..c2fb803e03f3d459baeb4188975192ef83aa3b71 Binary files /dev/null and b/src/main/resources/textures/player/sentinels/SentinelDown00.png differ diff --git a/src/main/resources/textures/player/sentinels/SentinelDown01.png b/src/main/resources/textures/player/sentinels/SentinelDown01.png new file mode 100644 index 0000000000000000000000000000000000000000..bb87d3b89b7a54dd62fde0c509d9d0ae09e549c4 Binary files /dev/null and b/src/main/resources/textures/player/sentinels/SentinelDown01.png differ diff --git a/src/main/resources/videos/=D.mp4 b/src/main/resources/videos/=D.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..a83c91d46b68617ecf3c40b8f91ab67f930e53b6 Binary files /dev/null and b/src/main/resources/videos/=D.mp4 differ diff --git a/src/main/resources/videos/allMyFellas.mp4 b/src/main/resources/videos/allMyFellas.mp4 index 4234d4da1c07a7e775bced2e4e44c2329c8be972..5371bd89089430d7fa4e467da0e857743a9cdd0b 100644 Binary files a/src/main/resources/videos/allMyFellas.mp4 and b/src/main/resources/videos/allMyFellas.mp4 differ diff --git a/src/main/resources/videos/async.mp4 b/src/main/resources/videos/async.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..4fef92ce7683b37e7e5dd01c5d6561fdaef4310c Binary files /dev/null and b/src/main/resources/videos/async.mp4 differ diff --git a/src/main/resources/videos/banana.mp4 b/src/main/resources/videos/banana.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..389d4987f86aa037d333fc7f2c84ecf9d1bc02f8 Binary files /dev/null and b/src/main/resources/videos/banana.mp4 differ diff --git a/src/main/resources/videos/basketball.mp4 b/src/main/resources/videos/basketball.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..067fcfbcc003a71f39c03b43e1882ceda9e9869c Binary files /dev/null and b/src/main/resources/videos/basketball.mp4 differ diff --git a/src/main/resources/videos/bear.mp4 b/src/main/resources/videos/bear.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..a74b90e33e6a40e197818a80d149c4626a3bed7d Binary files /dev/null and b/src/main/resources/videos/bear.mp4 differ diff --git a/src/main/resources/videos/carl.mp4 b/src/main/resources/videos/carl.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..54685a745086afb498765ff1e681655871e0225e Binary files /dev/null and b/src/main/resources/videos/carl.mp4 differ diff --git a/src/main/resources/videos/cat.mp4 b/src/main/resources/videos/cat.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..f9c8f30586069bb8c693e3278a33c7e0e0c274ce Binary files /dev/null and b/src/main/resources/videos/cat.mp4 differ diff --git a/src/main/resources/videos/catEating.mp4 b/src/main/resources/videos/catEating.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..530059520bc6a7ec848fca40e27371fac757171a Binary files /dev/null and b/src/main/resources/videos/catEating.mp4 differ diff --git a/src/main/resources/videos/catSitting.mp4 b/src/main/resources/videos/catSitting.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..28007e146999a02253044e4423819e80ec590c22 Binary files /dev/null and b/src/main/resources/videos/catSitting.mp4 differ diff --git a/src/main/resources/videos/chaCha.mp4 b/src/main/resources/videos/chaCha.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..700b233f8ce39926076fd7870bd6920d603c8d23 Binary files /dev/null and b/src/main/resources/videos/chaCha.mp4 differ diff --git a/src/main/resources/videos/cheezburger.mp4 b/src/main/resources/videos/cheezburger.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..4910d355b7ef46d080954028c2c9376ba7993a92 Binary files /dev/null and b/src/main/resources/videos/cheezburger.mp4 differ diff --git a/src/main/resources/videos/construction.mp4 b/src/main/resources/videos/construction.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..0d313d3f92093732300fcfe69d27f6583c66cb99 Binary files /dev/null and b/src/main/resources/videos/construction.mp4 differ diff --git a/src/main/resources/videos/credits.mp4 b/src/main/resources/videos/credits.mp4 index 310acc2c75039d7bdad7f3d642e2d0e828573811..410d261aba44faf7e6f2ba606393f76ba1ba526f 100644 Binary files a/src/main/resources/videos/credits.mp4 and b/src/main/resources/videos/credits.mp4 differ diff --git a/src/main/resources/videos/depression.mp4 b/src/main/resources/videos/depression.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..9e282df3676adcb28bc15d9238025fe6b37d9fcb Binary files /dev/null and b/src/main/resources/videos/depression.mp4 differ diff --git a/src/main/resources/videos/dog.mp4 b/src/main/resources/videos/dog.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..2f291192b17204d93730dede0be6a24f1fa26066 Binary files /dev/null and b/src/main/resources/videos/dog.mp4 differ diff --git a/src/main/resources/videos/dog2.mp4 b/src/main/resources/videos/dog2.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..4500f7ae5c2e9d8d1ba8a06fdfb60a0cc47f2d7b Binary files /dev/null and b/src/main/resources/videos/dog2.mp4 differ diff --git a/src/main/resources/videos/dogCheese.mp4 b/src/main/resources/videos/dogCheese.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..eb24b7b5f7b5d2eb6a72dcb0b3ac1d3281cd789b Binary files /dev/null and b/src/main/resources/videos/dogCheese.mp4 differ diff --git a/src/main/resources/videos/firework.mp4 b/src/main/resources/videos/firework.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..706941c2cde672b81881056aa759308d67f433c0 Binary files /dev/null and b/src/main/resources/videos/firework.mp4 differ diff --git a/src/main/resources/videos/frog.mp4 b/src/main/resources/videos/frog.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..e411b29309d38ffa3421e36ed3e9a3f4e9f9ad39 Binary files /dev/null and b/src/main/resources/videos/frog.mp4 differ diff --git a/src/main/resources/videos/gameboy.mp4 b/src/main/resources/videos/gameboy.mp4 index 91a1eaa78366adbb3686a07594417fd9c8832126..68821d3565f0efcc9995b2f7afaa220b9ca786eb 100644 Binary files a/src/main/resources/videos/gameboy.mp4 and b/src/main/resources/videos/gameboy.mp4 differ diff --git a/src/main/resources/videos/gamecube.mp4 b/src/main/resources/videos/gamecube.mp4 index 135416e7b63fc25ed1e3e2b744c6d14a78692b99..a60bade2b34051ffd295a22de564a6476adbe8fc 100644 Binary files a/src/main/resources/videos/gamecube.mp4 and b/src/main/resources/videos/gamecube.mp4 differ diff --git a/src/main/resources/videos/gta.mp4 b/src/main/resources/videos/gta.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..0259ca609572a35adb34f9c7293d49c9e97e37b8 Binary files /dev/null and b/src/main/resources/videos/gta.mp4 differ diff --git a/src/main/resources/videos/gtfo.mp4 b/src/main/resources/videos/gtfo.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..536961ae8a9414f7b16ac646d4ceb0844d13a23f Binary files /dev/null and b/src/main/resources/videos/gtfo.mp4 differ diff --git a/src/main/resources/videos/holyCrap.mp4 b/src/main/resources/videos/holyCrap.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..1f294f38de16731b5f4f5261ebebd0b2356380f3 Binary files /dev/null and b/src/main/resources/videos/holyCrap.mp4 differ diff --git a/src/main/resources/videos/horse.mp4 b/src/main/resources/videos/horse.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..d4f6f7429a9f49344bf63f6602ac35131338b2a0 Binary files /dev/null and b/src/main/resources/videos/horse.mp4 differ diff --git a/src/main/resources/videos/imNotYou.mp4 b/src/main/resources/videos/imNotYou.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..ade7b0800c3a53b242182a065022a91475ac367e Binary files /dev/null and b/src/main/resources/videos/imNotYou.mp4 differ diff --git a/src/main/resources/videos/kangaroo.mp4 b/src/main/resources/videos/kangaroo.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..3cff449b6180fcbdbe367da02416525331ae94af Binary files /dev/null and b/src/main/resources/videos/kangaroo.mp4 differ diff --git a/src/main/resources/videos/legCat.mp4 b/src/main/resources/videos/legCat.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..82644243c6fd83c051092f40337df516edf8f6d0 Binary files /dev/null and b/src/main/resources/videos/legCat.mp4 differ diff --git a/src/main/resources/videos/lessGoo.mp4 b/src/main/resources/videos/lessGoo.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..a90f7c54729bcd5c78ad95f490520d97fab10920 Binary files /dev/null and b/src/main/resources/videos/lessGoo.mp4 differ diff --git a/src/main/resources/videos/lifeCouldBeMonke.mp4 b/src/main/resources/videos/lifeCouldBeMonke.mp4 index 67a0106470b6e00d968f9930b5081d517545b3e4..13f8bf59c6c1d068156d65e04cdacf19070066c9 100644 Binary files a/src/main/resources/videos/lifeCouldBeMonke.mp4 and b/src/main/resources/videos/lifeCouldBeMonke.mp4 differ diff --git a/src/main/resources/videos/minecraftCat.mp4 b/src/main/resources/videos/minecraftCat.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..27e80735688963c86e27d81c6da25200da5854aa Binary files /dev/null and b/src/main/resources/videos/minecraftCat.mp4 differ diff --git a/src/main/resources/videos/minecraftCat2.mp4 b/src/main/resources/videos/minecraftCat2.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..1e9366af84a9aa9f363655de9b313cab98e77fba Binary files /dev/null and b/src/main/resources/videos/minecraftCat2.mp4 differ diff --git a/src/main/resources/videos/monke.mp4 b/src/main/resources/videos/monke.mp4 index c6d5f3c2e7f390276d22b26e46f462bb1e281d98..980756e7cd8fa4c3c00d5a246ad179b143c1fae1 100644 Binary files a/src/main/resources/videos/monke.mp4 and b/src/main/resources/videos/monke.mp4 differ diff --git a/src/main/resources/videos/msPuff.mp4 b/src/main/resources/videos/msPuff.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..42c91ab4bc895be00b0704f7eb73cded4c896d4f Binary files /dev/null and b/src/main/resources/videos/msPuff.mp4 differ diff --git a/src/main/resources/videos/muecke.mp4 b/src/main/resources/videos/muecke.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..c146f51e85f55df05f872781e4cfb09d5b222b87 Binary files /dev/null and b/src/main/resources/videos/muecke.mp4 differ diff --git a/src/main/resources/videos/myMind.mp4 b/src/main/resources/videos/myMind.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..e4616242924e020b3f536320e51a434aad0cdc69 Binary files /dev/null and b/src/main/resources/videos/myMind.mp4 differ diff --git a/src/main/resources/videos/pablo.mp4 b/src/main/resources/videos/pablo.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..b5d84444d5036bbb1c99cea570fb8a75e078c6f3 Binary files /dev/null and b/src/main/resources/videos/pablo.mp4 differ diff --git a/src/main/resources/videos/pancake.mp4 b/src/main/resources/videos/pancake.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..5bda0b20ea3bd71adbfa4d47ed90dfaf88dad5e1 Binary files /dev/null and b/src/main/resources/videos/pancake.mp4 differ diff --git a/src/main/resources/videos/parkingTickets.mp4 b/src/main/resources/videos/parkingTickets.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..cfebfc02ba32074f6415fe842956776a5cf09f3e Binary files /dev/null and b/src/main/resources/videos/parkingTickets.mp4 differ diff --git a/src/main/resources/videos/pot.mp4 b/src/main/resources/videos/pot.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..1aa9d7a0ce192a769e5096bcaf549234778a84c5 Binary files /dev/null and b/src/main/resources/videos/pot.mp4 differ diff --git a/src/main/resources/videos/rejectHumanity.mp4 b/src/main/resources/videos/rejectHumanity.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..6c2a377ca00e8f9381095c76661e5de75902b4f0 Binary files /dev/null and b/src/main/resources/videos/rejectHumanity.mp4 differ diff --git a/src/main/resources/videos/roomba.mp4 b/src/main/resources/videos/roomba.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..65a1e5aebe700b1b720182bf9ceaff3e6e160f88 Binary files /dev/null and b/src/main/resources/videos/roomba.mp4 differ diff --git a/src/main/resources/videos/sad.mp4 b/src/main/resources/videos/sad.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..9eb120c9e461edaed7858c02a42d44dc25f49e31 Binary files /dev/null and b/src/main/resources/videos/sad.mp4 differ diff --git a/src/main/resources/videos/sadCat.mp4 b/src/main/resources/videos/sadCat.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..6daceb2c5e67a7b328aa541cb4f076249ce1fdf5 Binary files /dev/null and b/src/main/resources/videos/sadCat.mp4 differ diff --git a/src/main/resources/videos/sadHorse.mp4 b/src/main/resources/videos/sadHorse.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..dc6901a500652632c29c51d500b369044118ee58 Binary files /dev/null and b/src/main/resources/videos/sadHorse.mp4 differ diff --git a/src/main/resources/videos/seal.mp4 b/src/main/resources/videos/seal.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..5f5f39382d212d1b1cf15a9eaf44fb90ee06e4f9 Binary files /dev/null and b/src/main/resources/videos/seal.mp4 differ diff --git a/src/main/resources/videos/slippery.mp4 b/src/main/resources/videos/slippery.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..b26ecb1ceda0d65050f5244c98e76af43c717558 Binary files /dev/null and b/src/main/resources/videos/slippery.mp4 differ diff --git a/src/main/resources/videos/sony.mp4 b/src/main/resources/videos/sony.mp4 index 9d96aebfc39a033d379d613070c97e6122f8a175..158c13874cb0cd60ddbc9903b2658d4c0cfd2ded 100644 Binary files a/src/main/resources/videos/sony.mp4 and b/src/main/resources/videos/sony.mp4 differ diff --git a/src/main/resources/videos/top10Cats.mp4 b/src/main/resources/videos/top10Cats.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..9e0d5b532c067b4b7f5cb91402b91b71c9150261 Binary files /dev/null and b/src/main/resources/videos/top10Cats.mp4 differ diff --git a/src/main/resources/videos/waaahhh.mp4 b/src/main/resources/videos/waaahhh.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..1cba56386170639d4ad38f06caf09a5520d743de Binary files /dev/null and b/src/main/resources/videos/waaahhh.mp4 differ diff --git a/src/main/resources/videos/wolf.mp4 b/src/main/resources/videos/wolf.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..353523836c06ad5601edb60be81a99ebc644675e Binary files /dev/null and b/src/main/resources/videos/wolf.mp4 differ diff --git a/src/main/resources/videos/wooOOoo.mp4 b/src/main/resources/videos/wooOOoo.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..094c0d8df46be0db2aa87e3294d3fdfbf4ee4bd3 Binary files /dev/null and b/src/main/resources/videos/wooOOoo.mp4 differ diff --git a/src/main/resources/videos/yoinkySploinky.mp4 b/src/main/resources/videos/yoinkySploinky.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..ea88b4578ccc74f0228669792b4266b9860e3f0c Binary files /dev/null and b/src/main/resources/videos/yoinkySploinky.mp4 differ