From b93ff5b05c439d1d4a5d984ad02bf5e0c6e4ceb0 Mon Sep 17 00:00:00 2001 From: Swap Date: Wed, 13 Mar 2024 22:59:21 -0700 Subject: [PATCH 1/3] Migrate project to Gradle --- BulletHell/.classpath | 9 - BulletHell/.project | 17 - .../.settings/org.eclipse.jdt.core.prefs | 11 - BulletHell/build.gradle | 26 + .../gradle/wrapper/gradle-wrapper.properties | 7 + BulletHell/gradlew | 249 ++++ BulletHell/gradlew.bat | 92 ++ BulletHell/src/AudioPlayer.java | 126 +- BulletHell/src/Bullet.java | 228 ++-- BulletHell/src/BulletSpawner.java | 68 +- BulletHell/src/Character.java | 296 ++--- BulletHell/src/DatabaseDriver.java | 140 +-- BulletHell/src/HellGirl.java | 5 + BulletHell/src/Main.java | 1056 ++++++++--------- 14 files changed, 1336 insertions(+), 994 deletions(-) delete mode 100644 BulletHell/.classpath delete mode 100644 BulletHell/.project delete mode 100644 BulletHell/.settings/org.eclipse.jdt.core.prefs create mode 100644 BulletHell/build.gradle create mode 100644 BulletHell/gradle/wrapper/gradle-wrapper.properties create mode 100644 BulletHell/gradlew create mode 100644 BulletHell/gradlew.bat create mode 100644 BulletHell/src/HellGirl.java diff --git a/BulletHell/.classpath b/BulletHell/.classpath deleted file mode 100644 index 1a1a7db..0000000 --- a/BulletHell/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/BulletHell/.project b/BulletHell/.project deleted file mode 100644 index fa6a1c2..0000000 --- a/BulletHell/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - BulletHell - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/BulletHell/.settings/org.eclipse.jdt.core.prefs b/BulletHell/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index bb35fa0..0000000 --- a/BulletHell/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/BulletHell/build.gradle b/BulletHell/build.gradle new file mode 100644 index 0000000..f248c32 --- /dev/null +++ b/BulletHell/build.gradle @@ -0,0 +1,26 @@ +plugins { + id 'java' + id 'application' + id 'org.openjfx.javafxplugin' version '0.1.0' +} + +repositories { + mavenCentral() +} + +javafx { + version = '17' + modules = [ 'javafx.controls', 'javafx.media' ] + platform = 'win' +} + +sourceSets { + main { + java { + srcDirs = ['./src'] + } + resources { + srcDirs = ['./res'] + } + } +} \ No newline at end of file diff --git a/BulletHell/gradle/wrapper/gradle-wrapper.properties b/BulletHell/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ac72c34 --- /dev/null +++ b/BulletHell/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/BulletHell/gradlew b/BulletHell/gradlew new file mode 100644 index 0000000..0adc8e1 --- /dev/null +++ b/BulletHell/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/BulletHell/gradlew.bat b/BulletHell/gradlew.bat new file mode 100644 index 0000000..93e3f59 --- /dev/null +++ b/BulletHell/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/BulletHell/src/AudioPlayer.java b/BulletHell/src/AudioPlayer.java index 615eaf8..24bdf7a 100644 --- a/BulletHell/src/AudioPlayer.java +++ b/BulletHell/src/AudioPlayer.java @@ -1,63 +1,63 @@ -import javafx.scene.media.AudioClip; - -public class AudioPlayer { - private AudioClip cursorHover; - private AudioClip gameMusic; - private AudioClip wind; - private AudioClip death; - private AudioClip select; - - public AudioPlayer() { - cursorHover = new AudioClip(getClass().getResource("sounds/cursorHover.wav").toString()); - gameMusic = new AudioClip(getClass().getResource("sounds/gameMusic.wav").toString()); - wind = new AudioClip(getClass().getResource("sounds/wind.wav").toString()); - death = new AudioClip(getClass().getResource("sounds/death.wav").toString()); - select = new AudioClip(getClass().getResource("sounds/select.wav").toString()); - cursorHover.setRate(2); - death.setRate(2); - } - - public void playCursorHover() { - cursorHover.play(); - } - - public void playWind() { - wind.setCycleCount(AudioClip.INDEFINITE); - wind.play(); - } - - public void stopWind() { - if(wind.isPlaying()) { - wind.stop(); - } - } - - public void playMusic() { - gameMusic.setCycleCount(AudioClip.INDEFINITE); - gameMusic.setRate(1); - gameMusic.play(); - } - - public void stopMusic() { - if(gameMusic.isPlaying()) { - gameMusic.stop(); - } - } - - public void playDeath() { - death.play(); - } - - public void playSelect() { - select.play(); - } - - public void playGameOver() { - if(gameMusic.isPlaying()) { - gameMusic.stop(); - } - gameMusic.setCycleCount(AudioClip.INDEFINITE); - gameMusic.setRate(0.5); - gameMusic.play(); - } -} +import javafx.scene.media.AudioClip; + +public class AudioPlayer { + private AudioClip cursorHover; + private AudioClip gameMusic; + private AudioClip wind; + private AudioClip death; + private AudioClip select; + + public AudioPlayer() { + cursorHover = new AudioClip(getClass().getResource("sounds/cursorHover.wav").toString()); + gameMusic = new AudioClip(getClass().getResource("sounds/gameMusic.wav").toString()); + wind = new AudioClip(getClass().getResource("sounds/wind.wav").toString()); + death = new AudioClip(getClass().getResource("sounds/death.wav").toString()); + select = new AudioClip(getClass().getResource("sounds/select.wav").toString()); + cursorHover.setRate(2); + death.setRate(2); + } + + public void playCursorHover() { + cursorHover.play(); + } + + public void playWind() { + wind.setCycleCount(AudioClip.INDEFINITE); + wind.play(); + } + + public void stopWind() { + if(wind.isPlaying()) { + wind.stop(); + } + } + + public void playMusic() { + gameMusic.setCycleCount(AudioClip.INDEFINITE); + gameMusic.setRate(1); + gameMusic.play(); + } + + public void stopMusic() { + if(gameMusic.isPlaying()) { + gameMusic.stop(); + } + } + + public void playDeath() { + death.play(); + } + + public void playSelect() { + select.play(); + } + + public void playGameOver() { + if(gameMusic.isPlaying()) { + gameMusic.stop(); + } + gameMusic.setCycleCount(AudioClip.INDEFINITE); + gameMusic.setRate(0.5); + gameMusic.play(); + } +} diff --git a/BulletHell/src/Bullet.java b/BulletHell/src/Bullet.java index bb033cd..25c32ca 100644 --- a/BulletHell/src/Bullet.java +++ b/BulletHell/src/Bullet.java @@ -1,114 +1,114 @@ -import java.net.URISyntaxException; - -import javafx.geometry.Bounds; -import javafx.scene.image.Image; -import javafx.scene.image.ImageView; -import javafx.scene.layout.Pane; -import javafx.scene.paint.Color; -import javafx.scene.shape.Circle; - -public class Bullet extends Pane { - - private Image bulletImage; - private ImageView bulletImageView; - private Circle hitCircle; - private boolean outOfBounds; - private double x; - private double y; - private double xVelocity; - private double yVelocity; - private double gamePaneWidth; - private double gamePaneHeight; - private Pane gamePane; - - public Bullet(Pane gameField, double startX, double startY, double xTrajectory, double yTrajectory) { - gamePane = gameField; - randomGenerateSprite(); - hitCircle = new Circle(4, Color.TRANSPARENT); - this.getChildren().add(hitCircle); - - x = startX; - y = startY; - xVelocity = xTrajectory; - yVelocity = yTrajectory; - refreshLocation(); - - gamePaneHeight = gameField.getPrefHeight(); - gamePaneWidth = gameField.getPrefWidth(); - outOfBounds = false; - } - - public void update() { - x += xVelocity; - y += yVelocity; - if(x<0) { - outOfBounds = true; - this.getChildren().remove(bulletImageView); - } - else if(x>gamePaneWidth-hitCircle.getRadius()) { - outOfBounds = true; - this.getChildren().remove(bulletImageView); - } - else if(y>gamePaneHeight-hitCircle.getRadius()) { - outOfBounds = true; - this.getChildren().remove(bulletImageView); - } - else { - refreshLocation(); - } - } - - public void randomGenerateSprite() { - double randomNumber = Math.random()*100; - if(randomNumber < 14) { - createImageView("images/blueBullet.png"); - } - else if(randomNumber < 28) { - createImageView("images/cyanBullet.png"); - } - else if(randomNumber < 42) { - createImageView("images/greenBullet.png"); - } - else if(randomNumber < 56) { - createImageView("images/orangeBullet.png"); - } - else if(randomNumber < 70) { - createImageView("images/redBullet.png"); - } - else if(randomNumber < 84) { - createImageView("images/yellowBullet.png"); - } - else if(randomNumber < 98) { - createImageView("images/whiteBullet.png"); - } - - } - - public void createImageView(String filename) { - try { - bulletImage= new Image(getClass().getResource(filename).toURI().toString()); - bulletImageView = new ImageView(bulletImage); - this.getChildren().add(bulletImageView); - } catch (URISyntaxException e) { - e.printStackTrace(); - } - } - - public void refreshLocation() { - this.relocate(x, y); - try { - hitCircle.setCenterX(bulletImageView.getImage().getWidth()/2); - hitCircle.setCenterY(bulletImageView.getImage().getHeight()/2); - } catch (Exception e) { - } - - } - - public Bounds getHitBoxBounds() { - return gamePane.sceneToLocal(this.localToScene(hitCircle.getBoundsInLocal())); - } - - public boolean isOutOfBounds() { - return outOfBounds; - } -} +import java.net.URISyntaxException; + +import javafx.geometry.Bounds; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import javafx.scene.layout.Pane; +import javafx.scene.paint.Color; +import javafx.scene.shape.Circle; + +public class Bullet extends Pane { + + private Image bulletImage; + private ImageView bulletImageView; + private Circle hitCircle; + private boolean outOfBounds; + private double x; + private double y; + private double xVelocity; + private double yVelocity; + private double gamePaneWidth; + private double gamePaneHeight; + private Pane gamePane; + + public Bullet(Pane gameField, double startX, double startY, double xTrajectory, double yTrajectory) { + gamePane = gameField; + randomGenerateSprite(); + hitCircle = new Circle(4, Color.TRANSPARENT); + this.getChildren().add(hitCircle); + + x = startX; + y = startY; + xVelocity = xTrajectory; + yVelocity = yTrajectory; + refreshLocation(); + + gamePaneHeight = gameField.getPrefHeight(); + gamePaneWidth = gameField.getPrefWidth(); + outOfBounds = false; + } + + public void update() { + x += xVelocity; + y += yVelocity; + if(x<0) { + outOfBounds = true; + this.getChildren().remove(bulletImageView); + } + else if(x>gamePaneWidth-hitCircle.getRadius()) { + outOfBounds = true; + this.getChildren().remove(bulletImageView); + } + else if(y>gamePaneHeight-hitCircle.getRadius()) { + outOfBounds = true; + this.getChildren().remove(bulletImageView); + } + else { + refreshLocation(); + } + } + + public void randomGenerateSprite() { + double randomNumber = Math.random()*100; + if(randomNumber < 14) { + createImageView("images/blueBullet.png"); + } + else if(randomNumber < 28) { + createImageView("images/cyanBullet.png"); + } + else if(randomNumber < 42) { + createImageView("images/greenBullet.png"); + } + else if(randomNumber < 56) { + createImageView("images/orangeBullet.png"); + } + else if(randomNumber < 70) { + createImageView("images/redBullet.png"); + } + else if(randomNumber < 84) { + createImageView("images/yellowBullet.png"); + } + else if(randomNumber < 98) { + createImageView("images/whiteBullet.png"); + } + + } + + public void createImageView(String filename) { + try { + bulletImage= new Image(getClass().getResource(filename).toURI().toString()); + bulletImageView = new ImageView(bulletImage); + this.getChildren().add(bulletImageView); + } catch (URISyntaxException e) { + e.printStackTrace(); + } + } + + public void refreshLocation() { + this.relocate(x, y); + try { + hitCircle.setCenterX(bulletImageView.getImage().getWidth()/2); + hitCircle.setCenterY(bulletImageView.getImage().getHeight()/2); + } catch (Exception e) { + } + + } + + public Bounds getHitBoxBounds() { + return gamePane.sceneToLocal(this.localToScene(hitCircle.getBoundsInLocal())); + } + + public boolean isOutOfBounds() { + return outOfBounds; + } +} diff --git a/BulletHell/src/BulletSpawner.java b/BulletHell/src/BulletSpawner.java index b4a764c..c55961d 100644 --- a/BulletHell/src/BulletSpawner.java +++ b/BulletHell/src/BulletSpawner.java @@ -1,34 +1,34 @@ -import java.util.LinkedList; -import java.util.Random; - -import javafx.scene.layout.Pane; - -public class BulletSpawner{ - - private double gamePaneHeight; - private double gamePaneWidth; - private Pane gamePane; - - public BulletSpawner(Pane gamePane) { - this.gamePane = gamePane; - gamePaneHeight = gamePane.getPrefHeight(); - gamePaneWidth = gamePane.getPrefWidth(); - } - - public LinkedList spawnRandomBullets(){ - LinkedList spawnedBullets = new LinkedList(); - Random random = new Random(); - int numBullets = random.nextInt(25)+10; - for(int i=0 ; i spawnRandomBullets(){ + LinkedList spawnedBullets = new LinkedList(); + Random random = new Random(); + int numBullets = random.nextInt(25)+10; + for(int i=0 ; igamePaneWidth-spriteImageView.getImage().getWidth()) { - x=gamePaneWidth-spriteImageView.getImage().getWidth(); - } - if(y<0) { - y=0; - } - else if(y>gamePaneHeight-spriteImageView.getImage().getHeight()) { - y=gamePaneHeight-spriteImageView.getImage().getHeight(); - } - refreshLocation(); - } - - public void moveUp() { - //TODO: Check bounds on game area - yVelocity = -SPEED; - setStraightImage(); - } - - public void moveDown() { - //TODO: Check bounds on game area - yVelocity = SPEED; - setStraightImage(); - } - - public void moveLeft() { - xVelocity = -SPEED; - setLeftImage(); - } - - public void moveRight() { - xVelocity = SPEED; - setRightImage(); - } - - public void stopXMovement() { - xVelocity=0; - setStraightImage(); - } - - public void stopYMovement() { - yVelocity=0; - } - - public void setStraightImage() { - spriteImageView.setImage(spriteStraightImage); - } - public void setLeftImage() { - spriteImageView.setImage(spriteLeftImage); - } - public void setRightImage() { - spriteImageView.setImage(spriteRightImage); - } - - public void refreshLocation() { - this.relocate(x, y); - hitCircle.setCenterX((spriteImageView.getImage().getWidth()/2)-2); - hitCircle.setCenterY(spriteImageView.getImage().getHeight()/2); - } - - public void loseLife() { - lives--; - x = (gamePaneWidth - spriteImageView.getImage().getWidth()) / 2.0; - y = gamePaneHeight * 0.8; - refreshLocation(); - - } - - public int getLives() { - return lives; - } - public boolean isDead() { - return lives<=0; - } - - public Bounds getHitBoxBounds() { - return gamePane.sceneToLocal(this.localToScene(hitCircle.getBoundsInLocal())); - } - - public boolean isInvincible() { - return invincible; - } - - public void addInvincibility() { - invincible = true; - } - - public void removeInvincibility() { - invincible = false; - } -} +import java.net.URISyntaxException; + +import javafx.geometry.Bounds; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import javafx.scene.layout.Pane; +import javafx.scene.paint.Color; +import javafx.scene.shape.Circle; + +public class Character extends Pane{ + private static int SPEED = 4; + + private ImageView spriteImageView; + private Image spriteStraightImage; + private Image spriteLeftImage; + private Image spriteRightImage; + private int lives; + private double x; + private double y; + private double xVelocity; + private double yVelocity; + private double gamePaneHeight; + private double gamePaneWidth; + private Pane gamePane; + private Circle hitCircle; + private boolean invincible; + + public Character(Pane gamePane) { + this.gamePane = gamePane; + lives = 3; + xVelocity=0; + yVelocity=0; + gamePaneWidth = gamePane.getPrefWidth(); + gamePaneHeight = gamePane.getPrefHeight(); + try { + spriteStraightImage = new Image(getClass().getResource("images/straightFlight.png").toURI().toString()); + spriteLeftImage = new Image(getClass().getResource("images/leftFlight.png").toURI().toString()); + spriteRightImage = new Image(getClass().getResource("images/rightFlight.png").toURI().toString()); + spriteImageView = new ImageView(spriteStraightImage); + this.getChildren().add(spriteImageView); + } catch (URISyntaxException e) { + e.printStackTrace(); + } + x = (gamePaneWidth - spriteImageView.getImage().getWidth()) / 2.0; + y = gamePaneHeight * 0.8; + + hitCircle = new Circle(3, Color.CHARTREUSE); + this.getChildren().add(hitCircle); + refreshLocation(); + invincible = false; + } + + public void update() { + x+=xVelocity; + y+=yVelocity; + if(x<0) { + x=0; + } + else if(x>gamePaneWidth-spriteImageView.getImage().getWidth()) { + x=gamePaneWidth-spriteImageView.getImage().getWidth(); + } + if(y<0) { + y=0; + } + else if(y>gamePaneHeight-spriteImageView.getImage().getHeight()) { + y=gamePaneHeight-spriteImageView.getImage().getHeight(); + } + refreshLocation(); + } + + public void moveUp() { + //TODO: Check bounds on game area + yVelocity = -SPEED; + setStraightImage(); + } + + public void moveDown() { + //TODO: Check bounds on game area + yVelocity = SPEED; + setStraightImage(); + } + + public void moveLeft() { + xVelocity = -SPEED; + setLeftImage(); + } + + public void moveRight() { + xVelocity = SPEED; + setRightImage(); + } + + public void stopXMovement() { + xVelocity=0; + setStraightImage(); + } + + public void stopYMovement() { + yVelocity=0; + } + + public void setStraightImage() { + spriteImageView.setImage(spriteStraightImage); + } + public void setLeftImage() { + spriteImageView.setImage(spriteLeftImage); + } + public void setRightImage() { + spriteImageView.setImage(spriteRightImage); + } + + public void refreshLocation() { + this.relocate(x, y); + hitCircle.setCenterX((spriteImageView.getImage().getWidth()/2)-2); + hitCircle.setCenterY(spriteImageView.getImage().getHeight()/2); + } + + public void loseLife() { + lives--; + x = (gamePaneWidth - spriteImageView.getImage().getWidth()) / 2.0; + y = gamePaneHeight * 0.8; + refreshLocation(); + + } + + public int getLives() { + return lives; + } + public boolean isDead() { + return lives<=0; + } + + public Bounds getHitBoxBounds() { + return gamePane.sceneToLocal(this.localToScene(hitCircle.getBoundsInLocal())); + } + + public boolean isInvincible() { + return invincible; + } + + public void addInvincibility() { + invincible = true; + } + + public void removeInvincibility() { + invincible = false; + } +} diff --git a/BulletHell/src/DatabaseDriver.java b/BulletHell/src/DatabaseDriver.java index cdab315..c15fea4 100644 --- a/BulletHell/src/DatabaseDriver.java +++ b/BulletHell/src/DatabaseDriver.java @@ -1,70 +1,70 @@ -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class DatabaseDriver { - - private Connection connection; - - public DatabaseDriver() { - try { - connection = DriverManager.getConnection("jdbc:sqlite::resource:database/scoresdb.sqlite"); - } catch (SQLException e) { - System.out.println("Connection to database failed"); - connection = null; - } - } - - public boolean isDatabaseConnected() { - try { - if(connection==null || connection.isClosed()) { - return false; - } - } catch (SQLException e) { - e.printStackTrace(); - } - return true; - } - - public int[] getTopScores() { - int[] scoreList = {0,0,0}; - Statement statement; - try { - statement = connection.createStatement(); - ResultSet rs = statement.executeQuery("SELECT * FROM scores ORDER BY score DESC LIMIT 3"); - int i = 0; - while(rs.next()) - { - scoreList[i]=rs.getInt("score"); - i++; - } - } catch (SQLException e) { - System.out.println("Scores could not be printed."); - } - return scoreList; - } - - public void addScore(int newScore) { - PreparedStatement statement; - try { - statement = connection.prepareStatement("INSERT INTO scores(score) values(?)"); - statement.setInt(1, newScore); - statement.executeUpdate(); - } catch (SQLException e) { - System.out.println("Scores could not be added."); - } - } - - public void deleteAllScores() { - Statement statement; - try { - statement = connection.createStatement(); - statement.executeUpdate("DELETE FROM scores"); - } catch (SQLException e) { - System.out.println("Scores could not be printed."); - } - } -} +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; + +public class DatabaseDriver { + + private Connection connection; + + public DatabaseDriver() { + try { + connection = DriverManager.getConnection("jdbc:sqlite::resource:database/scoresdb.sqlite"); + } catch (SQLException e) { + System.out.println("Connection to database failed"); + connection = null; + } + } + + public boolean isDatabaseConnected() { + try { + if(connection==null || connection.isClosed()) { + return false; + } + } catch (SQLException e) { + e.printStackTrace(); + } + return true; + } + + public int[] getTopScores() { + int[] scoreList = {0,0,0}; + Statement statement; + try { + statement = connection.createStatement(); + ResultSet rs = statement.executeQuery("SELECT * FROM scores ORDER BY score DESC LIMIT 3"); + int i = 0; + while(rs.next()) + { + scoreList[i]=rs.getInt("score"); + i++; + } + } catch (SQLException e) { + System.out.println("Scores could not be printed."); + } + return scoreList; + } + + public void addScore(int newScore) { + PreparedStatement statement; + try { + statement = connection.prepareStatement("INSERT INTO scores(score) values(?)"); + statement.setInt(1, newScore); + statement.executeUpdate(); + } catch (SQLException e) { + System.out.println("Scores could not be added."); + } + } + + public void deleteAllScores() { + Statement statement; + try { + statement = connection.createStatement(); + statement.executeUpdate("DELETE FROM scores"); + } catch (SQLException e) { + System.out.println("Scores could not be printed."); + } + } +} diff --git a/BulletHell/src/HellGirl.java b/BulletHell/src/HellGirl.java new file mode 100644 index 0000000..eae8395 --- /dev/null +++ b/BulletHell/src/HellGirl.java @@ -0,0 +1,5 @@ +public class HellGirl { + public static void main(String[] args) { + Main.main(args); + } +} diff --git a/BulletHell/src/Main.java b/BulletHell/src/Main.java index d55d4ca..bf44fa0 100644 --- a/BulletHell/src/Main.java +++ b/BulletHell/src/Main.java @@ -1,528 +1,528 @@ -import java.net.URISyntaxException; -import java.util.Iterator; -import java.util.LinkedList; - -import javafx.animation.AnimationTimer; -import javafx.animation.FadeTransition; -import javafx.animation.SequentialTransition; -import javafx.animation.TranslateTransition; -import javafx.application.Application; -import javafx.application.Platform; -import javafx.event.EventHandler; -import javafx.geometry.Insets; -import javafx.scene.Scene; -import javafx.scene.effect.Glow; -import javafx.scene.image.Image; -import javafx.scene.image.ImageView; -import javafx.scene.input.KeyCode; -import javafx.scene.input.KeyEvent; -import javafx.scene.input.MouseEvent; -import javafx.scene.layout.AnchorPane; -import javafx.scene.layout.HBox; -import javafx.scene.layout.Pane; -import javafx.scene.paint.Color; -import javafx.scene.text.Font; -import javafx.scene.text.Text; -import javafx.stage.Stage; -import javafx.stage.WindowEvent; -import javafx.util.Duration; - -public class Main extends Application{ - /* - * Create Class Variables - */ - private AnchorPane mainPane; - private Pane gameField; - private HBox[] topScoreHBoxes; - private Character player; - LinkedList bulletList; - private Scene scene; - private AnimationTimer gameLoop; - private DatabaseDriver databaseDriver; - private BulletSpawner bulletSpawner; - private ImageView hellTitle; - private ImageView girlTitle; - private ImageView startTitle; - private ImageView gameOverTitle; - private ImageView topScoresTitle; - private AudioPlayer audioPlayer; - private Text scoreText; - private int score; - private ImageView[] livesImageList; - private boolean gameOver; - - @Override - public void start(Stage stage){ - initialize(stage); - createGameInputs(); - createGameLoop(); - createScoreHBox(); - createLivesHBox(); - createTitles(); - startingTitleTransition(); - //Play wind for menu screen - audioPlayer.playWind(); - //Create Thread to monitor if player is still alive to continue - new Thread(new Runnable() { - @Override - public void run() { - while(!gameOver) {try { - Thread.sleep(10); - } catch (InterruptedException e) { - e.printStackTrace(); - }} - audioPlayer.playGameOver(); - databaseDriver.addScore(score); - createTopScoresPane(); - } - }).start(); - - } - - /* - * Initialize variables and wire up panes - */ - public void initialize(Stage stage) { - //Create AnchorPane for root and link to scene then stage - mainPane = new AnchorPane(); - mainPane.setStyle("-fx-background-color: black;"); - scene = new Scene(mainPane,500, 600); - stage.setScene(scene); - stage.setResizable(false); - stage.setTitle("Bullet Hell!"); - stage.show(); - - stage.setOnCloseRequest(new EventHandler() { - @Override - public void handle(WindowEvent event) { - System.exit(0);} - }); - - //Create a Pane for our game - gameField = new Pane(); - gameField.setPrefSize(400, 500); - mainPane.getChildren().add(gameField); - gameField.setStyle("-fx-background-color: rgb(230, 96, 221, 0.2);"); - AnchorPane.setTopAnchor(gameField, 30.0); - AnchorPane.setLeftAnchor(gameField, 50.0); - - //Create the player object and add to game pane - player = new Character(gameField); - gameField.getChildren().add(player); - - //Create our list of bullets the player will have to dodge - bulletList = new LinkedList(); - gameField.getChildren().addAll(bulletList); - - //Create a BulletSpawer to spawn bullets - bulletSpawner = new BulletSpawner(gameField); - - //Create Audio Player for game sounds - audioPlayer = new AudioPlayer(); - - //Initialize score to zero - score = 0; - - //Initialize game over boolean - gameOver = false; - - //Initialize database driver - databaseDriver = new DatabaseDriver(); - } - - /* - * Create HBox Pane to house Score Image and Value - */ - public void createScoreHBox() { - HBox scoreHBox = new HBox(); - scoreText = new Text("0"); - scoreText.setFont(new Font("Arial Black", 30)); - scoreText.setFill(Color.DARKMAGENTA); - try { - ImageView scoreTitle = new ImageView(new Image(getClass().getResource("images/score.png").toURI().toString())); - scoreHBox.getChildren().addAll(scoreTitle, scoreText); - - mainPane.getChildren().add(scoreHBox); - AnchorPane.setLeftAnchor(scoreHBox, 50.0); - AnchorPane.setBottomAnchor(scoreHBox, 17.0); - } catch (URISyntaxException e) { - e.printStackTrace(); - } - } - - public void createTopScoresPane(){ - //Create our Text for our actual scores and style them - int [] topScores = databaseDriver.getTopScores(); - Text[] topScoreTexts = new Text[3]; - for(int i =0; i<3; i++) { - topScoreTexts[i] = new Text(String.valueOf(topScores[i])); - topScoreTexts[i].setFont(new Font("Arial Black", 20)); - topScoreTexts[i].setFill(Color.HOTPINK); - } - - //Create our Image and Image Views that will follow the score text - //We will put both these components in a HBox to group them - topScoreHBoxes = new HBox[3]; - try { - Image roundsImage = new Image(getClass().getResource("images/rounds.png").toURI().toString()); - - //Create a Thread to make UI Changes and Start Game Over Sequence - Platform.runLater(new Runnable() { - @Override - public void run() { - for(int i = 0; i<3; i++) { - //Add ImageView to our Top Score Hboxes and Put them in place - ImageView currImageView = new ImageView(roundsImage); - topScoreHBoxes[i] = new HBox(topScoreTexts[i], currImageView); - HBox.setMargin(currImageView, new Insets(5, 0, 0, 5)); - topScoreHBoxes[i].setOpacity(0); - mainPane.getChildren().add(topScoreHBoxes[i]); - AnchorPane.setTopAnchor(topScoreHBoxes[i], 255+ i*40.0); - AnchorPane.setLeftAnchor(topScoreHBoxes[i], 185.0); - } - //Start Game Over Transition - gameOverTransition(); - - } - }); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - - - } - - /* - * Change Player Score value on screen - */ - public void changeScore(int score) { - scoreText.setText(String.valueOf(score)); - } - - /* - * Create HBox Pane for displaying number of lives left - */ - public void createLivesHBox() { - HBox livesHBox = new HBox(); - //Create List of Lives Images to Place in our HBox - livesImageList = new ImageView[3]; - try { - Image chibiImage = new Image(getClass().getResource("images/chibi.png").toURI().toString()); - ImageView scoreTitle = new ImageView(new Image(getClass().getResource("images/lives.png").toURI().toString())); - //Create 3 of the same ImageView for each life - for(int i =0; i - { - startTitle.setEffect(new Glow(0.9)); - audioPlayer.playCursorHover(); - }); - - startTitle.setOnMouseExited(ev->{ - startTitle.setEffect(null); - }); - - /* - * When Start Game clicked play selected sounds, Start a Thread to make UI changes - * Make Audio Changes, and Start Game Loop - */ - startTitle.addEventHandler(MouseEvent.MOUSE_CLICKED, - ev->{ - audioPlayer.playSelect(); - startTitle.setVisible(false); - leavingTitleTransition(); - new Thread(new Runnable() { - @Override - public void run() { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - e.printStackTrace(); - } - audioPlayer.stopWind(); - audioPlayer.playMusic(); - gameLoop.start(); - } - }).start(); - }); - - } catch (URISyntaxException e) { - e.printStackTrace(); - } - } - - /* - * Create Starting Transition for the Title When Application is opened - */ - public void startingTitleTransition() { - //Create Hell title transitions - TranslateTransition hellTransition = new TranslateTransition(); - hellTransition.setNode(hellTitle); - hellTransition.setByX(1000); - hellTransition.setDuration(Duration.seconds(0.5)); - FadeTransition hellFadeTransition = new FadeTransition(Duration.millis(100)); - hellFadeTransition.setNode(hellTitle); - hellFadeTransition.setDelay(Duration.seconds(0.1)); - hellFadeTransition.setFromValue(1); - hellFadeTransition.setToValue(0); - hellFadeTransition.setAutoReverse(true); - hellFadeTransition.setCycleCount(10); - //Create Girl title - TranslateTransition girlTransition = new TranslateTransition(); - girlTransition.setNode(girlTitle); - girlTransition.setByX(-1000); - girlTransition.setDuration(Duration.seconds(0.5)); - FadeTransition girlFadeTransition = new FadeTransition(Duration.millis(100)); - girlFadeTransition.setNode(girlTitle); - girlFadeTransition.setDelay(Duration.seconds(0.1)); - girlFadeTransition.setFromValue(1); - girlFadeTransition.setToValue(0); - girlFadeTransition.setAutoReverse(true); - girlFadeTransition.setCycleCount(10); - - //Make Transition for Start Game Title - FadeTransition startTransition = new FadeTransition(Duration.millis(1000), startTitle); - startTransition.setDelay(Duration.seconds(0.2)); - startTransition.setFromValue(1); - startTransition.setToValue(0); - startTransition.setAutoReverse(true); - startTransition.setCycleCount(10); - - //Make Sequential Transitions and play them - SequentialTransition hellSequen = new SequentialTransition(); - hellSequen.getChildren().addAll(hellTransition, hellFadeTransition); - SequentialTransition girlSequen = new SequentialTransition(); - girlSequen.getChildren().addAll(girlTransition, girlFadeTransition); - - hellSequen.play(); - girlSequen.play(); - startTransition.play(); - } - - /* - * Create Transition for when game starting - */ - public void leavingTitleTransition() { - TranslateTransition hellTransition = new TranslateTransition(); - hellTransition.setNode(hellTitle); - hellTransition.setByX(1000); - hellTransition.setDuration(Duration.seconds(0.5)); - TranslateTransition girlTransition = new TranslateTransition(); - girlTransition.setNode(girlTitle); - girlTransition.setByX(-1000); - girlTransition.setDuration(Duration.seconds(0.5)); - hellTransition.play(); - girlTransition.play(); - } - - /* - * Create Transtitions for when the game has ended - */ - public void gameOverTransition() { - //GameOverTransitions - Game Over Title Descent - TranslateTransition gameOverTransition0 = new TranslateTransition(Duration.seconds(0.9), gameOverTitle); - gameOverTransition0.setByY(220); - TranslateTransition gameOverTransition1 = new TranslateTransition(Duration.seconds(0.2), gameOverTitle); - gameOverTransition1.setByY(-20); - TranslateTransition gameOverTransition2 = new TranslateTransition(Duration.seconds(0.4), gameOverTitle); - gameOverTransition2.setByY(20); - - //TopScoreTransitions - Fade in of Top 3 Score Title - FadeTransition topScoreTransition0 = new FadeTransition(Duration.seconds(0.7), topScoresTitle); - topScoreTransition0.setByValue(1); - FadeTransition topScoreTransition1 = new FadeTransition(Duration.seconds(0.5), topScoresTitle); - topScoreTransition1.setByValue(1); - topScoreTransition1.setCycleCount(2); - topScoreTransition1.setAutoReverse(true); - topScoreTransition1.setToValue(0); - - //ScoresSequentialTransition- Fade in each score one at a time - SequentialTransition scoresSequentialTransition = new SequentialTransition(); - for(int i = 0; i=0) { - livesImageList[lives].setVisible(false); - } - } - - /* - * Create our inputs to move the Player - */ - public void createGameInputs() { - //Move player in direction based on what key pressed - scene.addEventHandler(KeyEvent.KEY_PRESSED, - ev->{ - KeyCode code = ev.getCode(); - if(code==KeyCode.UP || code==KeyCode.W) { - player.moveUp(); - } - if(code==KeyCode.DOWN || code==KeyCode.S) { - player.moveDown(); - } - if(code==KeyCode.LEFT || code==KeyCode.A) { - player.moveLeft(); - } - if(code==KeyCode.RIGHT|| code==KeyCode.D) { - player.moveRight(); - } - } - ); - - //When keys are released stop its directional movement - scene.addEventHandler(KeyEvent.KEY_RELEASED, - ev->{ - KeyCode code = ev.getCode(); - if(code==KeyCode.UP || code==KeyCode.W) { - player.stopYMovement(); - } - if(code==KeyCode.DOWN || code==KeyCode.S) { - player.stopYMovement(); - } - if(code==KeyCode.LEFT || code==KeyCode.A) { - player.stopXMovement(); - } - if(code==KeyCode.RIGHT || code==KeyCode.D) { - player.stopXMovement(); - } - }); - } - - /* - * Remove all bullets from field if player hit or game over - */ - public void removeAllBullets() { - gameField.getChildren().removeAll(bulletList); - bulletList.clear(); - } - - /* - * Create Loop that will run game - */ - public void createGameLoop() { - //Create new Animation Timer - gameLoop = new AnimationTimer() { - //Create variables to keep track of time so we don't spawn to often - private long spawnTimer = 1000 * 1_000_000; - private long prevTime = 0; - @Override - public void handle(long now) { - /* - * Update player and bullet sprites by calling their update methods - */ - player.update(); - Iterator bulletIterator = bulletList.iterator(); - - //Iterate over bullet list - while(bulletIterator.hasNext()) { - Bullet bullet = bulletIterator.next(); - //If Bullet out of bounds remove it - if(bullet.isOutOfBounds()) { - gameField.getChildren().remove(bullet); - bulletIterator.remove(); - } - else { - //Move Bullet - bullet.update(); - /* - * If bullet hits play take away a life, add temporary invincibility, - * and stop iterating over bullets - */ - if(bullet.getHitBoxBounds().intersects(player.getHitBoxBounds()) && !player.isInvincible()) { - audioPlayer.playDeath(); - player.addInvincibility(); - player.loseLife(); - removeLife(); - removeAllBullets(); - if(player.isDead()) { - gameOver = true; - this.stop(); - } - break; - } - } - } - //If player invisible remove it and do not spawn bullets - if(player.isInvincible()) { - player.removeInvincibility(); - } - //Spawn bullets if timer allows it - else if (now-prevTime > spawnTimer) { - LinkedList newBullets = bulletSpawner.spawnRandomBullets(); - bulletList.addAll(newBullets); - gameField.getChildren().addAll(newBullets); - newBullets.clear(); - prevTime = now; - changeScore(++score); - } - - } - }; - } - - public static void main(String[] args) { - launch(args); - } - -} +import java.net.URISyntaxException; +import java.util.Iterator; +import java.util.LinkedList; + +import javafx.animation.AnimationTimer; +import javafx.animation.FadeTransition; +import javafx.animation.SequentialTransition; +import javafx.animation.TranslateTransition; +import javafx.application.Application; +import javafx.application.Platform; +import javafx.event.EventHandler; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.effect.Glow; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import javafx.scene.input.KeyCode; +import javafx.scene.input.KeyEvent; +import javafx.scene.input.MouseEvent; +import javafx.scene.layout.AnchorPane; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; +import javafx.scene.paint.Color; +import javafx.scene.text.Font; +import javafx.scene.text.Text; +import javafx.stage.Stage; +import javafx.stage.WindowEvent; +import javafx.util.Duration; + +public class Main extends Application{ + /* + * Create Class Variables + */ + private AnchorPane mainPane; + private Pane gameField; + private HBox[] topScoreHBoxes; + private Character player; + LinkedList bulletList; + private Scene scene; + private AnimationTimer gameLoop; + private DatabaseDriver databaseDriver; + private BulletSpawner bulletSpawner; + private ImageView hellTitle; + private ImageView girlTitle; + private ImageView startTitle; + private ImageView gameOverTitle; + private ImageView topScoresTitle; + private AudioPlayer audioPlayer; + private Text scoreText; + private int score; + private ImageView[] livesImageList; + private boolean gameOver; + + @Override + public void start(Stage stage){ + initialize(stage); + createGameInputs(); + createGameLoop(); + createScoreHBox(); + createLivesHBox(); + createTitles(); + startingTitleTransition(); + //Play wind for menu screen + audioPlayer.playWind(); + //Create Thread to monitor if player is still alive to continue + new Thread(new Runnable() { + @Override + public void run() { + while(!gameOver) {try { + Thread.sleep(10); + } catch (InterruptedException e) { + e.printStackTrace(); + }} + audioPlayer.playGameOver(); + databaseDriver.addScore(score); + createTopScoresPane(); + } + }).start(); + + } + + /* + * Initialize variables and wire up panes + */ + public void initialize(Stage stage) { + //Create AnchorPane for root and link to scene then stage + mainPane = new AnchorPane(); + mainPane.setStyle("-fx-background-color: black;"); + scene = new Scene(mainPane,500, 600); + stage.setScene(scene); + stage.setResizable(false); + stage.setTitle("Bullet Hell!"); + stage.show(); + + stage.setOnCloseRequest(new EventHandler() { + @Override + public void handle(WindowEvent event) { + System.exit(0);} + }); + + //Create a Pane for our game + gameField = new Pane(); + gameField.setPrefSize(400, 500); + mainPane.getChildren().add(gameField); + gameField.setStyle("-fx-background-color: rgb(230, 96, 221, 0.2);"); + AnchorPane.setTopAnchor(gameField, 30.0); + AnchorPane.setLeftAnchor(gameField, 50.0); + + //Create the player object and add to game pane + player = new Character(gameField); + gameField.getChildren().add(player); + + //Create our list of bullets the player will have to dodge + bulletList = new LinkedList(); + gameField.getChildren().addAll(bulletList); + + //Create a BulletSpawer to spawn bullets + bulletSpawner = new BulletSpawner(gameField); + + //Create Audio Player for game sounds + audioPlayer = new AudioPlayer(); + + //Initialize score to zero + score = 0; + + //Initialize game over boolean + gameOver = false; + + //Initialize database driver + databaseDriver = new DatabaseDriver(); + } + + /* + * Create HBox Pane to house Score Image and Value + */ + public void createScoreHBox() { + HBox scoreHBox = new HBox(); + scoreText = new Text("0"); + scoreText.setFont(new Font("Arial Black", 30)); + scoreText.setFill(Color.DARKMAGENTA); + try { + ImageView scoreTitle = new ImageView(new Image(getClass().getResource("images/score.png").toURI().toString())); + scoreHBox.getChildren().addAll(scoreTitle, scoreText); + + mainPane.getChildren().add(scoreHBox); + AnchorPane.setLeftAnchor(scoreHBox, 50.0); + AnchorPane.setBottomAnchor(scoreHBox, 17.0); + } catch (URISyntaxException e) { + e.printStackTrace(); + } + } + + public void createTopScoresPane(){ + //Create our Text for our actual scores and style them + int [] topScores = databaseDriver.getTopScores(); + Text[] topScoreTexts = new Text[3]; + for(int i =0; i<3; i++) { + topScoreTexts[i] = new Text(String.valueOf(topScores[i])); + topScoreTexts[i].setFont(new Font("Arial Black", 20)); + topScoreTexts[i].setFill(Color.HOTPINK); + } + + //Create our Image and Image Views that will follow the score text + //We will put both these components in a HBox to group them + topScoreHBoxes = new HBox[3]; + try { + Image roundsImage = new Image(getClass().getResource("images/rounds.png").toURI().toString()); + + //Create a Thread to make UI Changes and Start Game Over Sequence + Platform.runLater(new Runnable() { + @Override + public void run() { + for(int i = 0; i<3; i++) { + //Add ImageView to our Top Score Hboxes and Put them in place + ImageView currImageView = new ImageView(roundsImage); + topScoreHBoxes[i] = new HBox(topScoreTexts[i], currImageView); + HBox.setMargin(currImageView, new Insets(5, 0, 0, 5)); + topScoreHBoxes[i].setOpacity(0); + mainPane.getChildren().add(topScoreHBoxes[i]); + AnchorPane.setTopAnchor(topScoreHBoxes[i], 255+ i*40.0); + AnchorPane.setLeftAnchor(topScoreHBoxes[i], 185.0); + } + //Start Game Over Transition + gameOverTransition(); + + } + }); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + + } + + /* + * Change Player Score value on screen + */ + public void changeScore(int score) { + scoreText.setText(String.valueOf(score)); + } + + /* + * Create HBox Pane for displaying number of lives left + */ + public void createLivesHBox() { + HBox livesHBox = new HBox(); + //Create List of Lives Images to Place in our HBox + livesImageList = new ImageView[3]; + try { + Image chibiImage = new Image(getClass().getResource("images/chibi.png").toURI().toString()); + ImageView scoreTitle = new ImageView(new Image(getClass().getResource("images/lives.png").toURI().toString())); + //Create 3 of the same ImageView for each life + for(int i =0; i + { + startTitle.setEffect(new Glow(0.9)); + audioPlayer.playCursorHover(); + }); + + startTitle.setOnMouseExited(ev->{ + startTitle.setEffect(null); + }); + + /* + * When Start Game clicked play selected sounds, Start a Thread to make UI changes + * Make Audio Changes, and Start Game Loop + */ + startTitle.addEventHandler(MouseEvent.MOUSE_CLICKED, + ev->{ + audioPlayer.playSelect(); + startTitle.setVisible(false); + leavingTitleTransition(); + new Thread(new Runnable() { + @Override + public void run() { + try { + Thread.sleep(500); + } catch (InterruptedException e) { + e.printStackTrace(); + } + audioPlayer.stopWind(); + audioPlayer.playMusic(); + gameLoop.start(); + } + }).start(); + }); + + } catch (URISyntaxException e) { + e.printStackTrace(); + } + } + + /* + * Create Starting Transition for the Title When Application is opened + */ + public void startingTitleTransition() { + //Create Hell title transitions + TranslateTransition hellTransition = new TranslateTransition(); + hellTransition.setNode(hellTitle); + hellTransition.setByX(1000); + hellTransition.setDuration(Duration.seconds(0.5)); + FadeTransition hellFadeTransition = new FadeTransition(Duration.millis(100)); + hellFadeTransition.setNode(hellTitle); + hellFadeTransition.setDelay(Duration.seconds(0.1)); + hellFadeTransition.setFromValue(1); + hellFadeTransition.setToValue(0); + hellFadeTransition.setAutoReverse(true); + hellFadeTransition.setCycleCount(10); + //Create Girl title + TranslateTransition girlTransition = new TranslateTransition(); + girlTransition.setNode(girlTitle); + girlTransition.setByX(-1000); + girlTransition.setDuration(Duration.seconds(0.5)); + FadeTransition girlFadeTransition = new FadeTransition(Duration.millis(100)); + girlFadeTransition.setNode(girlTitle); + girlFadeTransition.setDelay(Duration.seconds(0.1)); + girlFadeTransition.setFromValue(1); + girlFadeTransition.setToValue(0); + girlFadeTransition.setAutoReverse(true); + girlFadeTransition.setCycleCount(10); + + //Make Transition for Start Game Title + FadeTransition startTransition = new FadeTransition(Duration.millis(1000), startTitle); + startTransition.setDelay(Duration.seconds(0.2)); + startTransition.setFromValue(1); + startTransition.setToValue(0); + startTransition.setAutoReverse(true); + startTransition.setCycleCount(10); + + //Make Sequential Transitions and play them + SequentialTransition hellSequen = new SequentialTransition(); + hellSequen.getChildren().addAll(hellTransition, hellFadeTransition); + SequentialTransition girlSequen = new SequentialTransition(); + girlSequen.getChildren().addAll(girlTransition, girlFadeTransition); + + hellSequen.play(); + girlSequen.play(); + startTransition.play(); + } + + /* + * Create Transition for when game starting + */ + public void leavingTitleTransition() { + TranslateTransition hellTransition = new TranslateTransition(); + hellTransition.setNode(hellTitle); + hellTransition.setByX(1000); + hellTransition.setDuration(Duration.seconds(0.5)); + TranslateTransition girlTransition = new TranslateTransition(); + girlTransition.setNode(girlTitle); + girlTransition.setByX(-1000); + girlTransition.setDuration(Duration.seconds(0.5)); + hellTransition.play(); + girlTransition.play(); + } + + /* + * Create Transtitions for when the game has ended + */ + public void gameOverTransition() { + //GameOverTransitions - Game Over Title Descent + TranslateTransition gameOverTransition0 = new TranslateTransition(Duration.seconds(0.9), gameOverTitle); + gameOverTransition0.setByY(220); + TranslateTransition gameOverTransition1 = new TranslateTransition(Duration.seconds(0.2), gameOverTitle); + gameOverTransition1.setByY(-20); + TranslateTransition gameOverTransition2 = new TranslateTransition(Duration.seconds(0.4), gameOverTitle); + gameOverTransition2.setByY(20); + + //TopScoreTransitions - Fade in of Top 3 Score Title + FadeTransition topScoreTransition0 = new FadeTransition(Duration.seconds(0.7), topScoresTitle); + topScoreTransition0.setByValue(1); + FadeTransition topScoreTransition1 = new FadeTransition(Duration.seconds(0.5), topScoresTitle); + topScoreTransition1.setByValue(1); + topScoreTransition1.setCycleCount(2); + topScoreTransition1.setAutoReverse(true); + topScoreTransition1.setToValue(0); + + //ScoresSequentialTransition- Fade in each score one at a time + SequentialTransition scoresSequentialTransition = new SequentialTransition(); + for(int i = 0; i=0) { + livesImageList[lives].setVisible(false); + } + } + + /* + * Create our inputs to move the Player + */ + public void createGameInputs() { + //Move player in direction based on what key pressed + scene.addEventHandler(KeyEvent.KEY_PRESSED, + ev->{ + KeyCode code = ev.getCode(); + if(code==KeyCode.UP || code==KeyCode.W) { + player.moveUp(); + } + if(code==KeyCode.DOWN || code==KeyCode.S) { + player.moveDown(); + } + if(code==KeyCode.LEFT || code==KeyCode.A) { + player.moveLeft(); + } + if(code==KeyCode.RIGHT|| code==KeyCode.D) { + player.moveRight(); + } + } + ); + + //When keys are released stop its directional movement + scene.addEventHandler(KeyEvent.KEY_RELEASED, + ev->{ + KeyCode code = ev.getCode(); + if(code==KeyCode.UP || code==KeyCode.W) { + player.stopYMovement(); + } + if(code==KeyCode.DOWN || code==KeyCode.S) { + player.stopYMovement(); + } + if(code==KeyCode.LEFT || code==KeyCode.A) { + player.stopXMovement(); + } + if(code==KeyCode.RIGHT || code==KeyCode.D) { + player.stopXMovement(); + } + }); + } + + /* + * Remove all bullets from field if player hit or game over + */ + public void removeAllBullets() { + gameField.getChildren().removeAll(bulletList); + bulletList.clear(); + } + + /* + * Create Loop that will run game + */ + public void createGameLoop() { + //Create new Animation Timer + gameLoop = new AnimationTimer() { + //Create variables to keep track of time so we don't spawn to often + private long spawnTimer = 1000 * 1_000_000; + private long prevTime = 0; + @Override + public void handle(long now) { + /* + * Update player and bullet sprites by calling their update methods + */ + player.update(); + Iterator bulletIterator = bulletList.iterator(); + + //Iterate over bullet list + while(bulletIterator.hasNext()) { + Bullet bullet = bulletIterator.next(); + //If Bullet out of bounds remove it + if(bullet.isOutOfBounds()) { + gameField.getChildren().remove(bullet); + bulletIterator.remove(); + } + else { + //Move Bullet + bullet.update(); + /* + * If bullet hits play take away a life, add temporary invincibility, + * and stop iterating over bullets + */ + if(bullet.getHitBoxBounds().intersects(player.getHitBoxBounds()) && !player.isInvincible()) { + audioPlayer.playDeath(); + player.addInvincibility(); + player.loseLife(); + removeLife(); + removeAllBullets(); + if(player.isDead()) { + gameOver = true; + this.stop(); + } + break; + } + } + } + //If player invisible remove it and do not spawn bullets + if(player.isInvincible()) { + player.removeInvincibility(); + } + //Spawn bullets if timer allows it + else if (now-prevTime > spawnTimer) { + LinkedList newBullets = bulletSpawner.spawnRandomBullets(); + bulletList.addAll(newBullets); + gameField.getChildren().addAll(newBullets); + newBullets.clear(); + prevTime = now; + changeScore(++score); + } + + } + }; + } + + public static void main(String[] args) { + launch(args); + } + +} From b122c25c3853da8f0f4fb80530c47b9f9052f1f7 Mon Sep 17 00:00:00 2001 From: Swap Date: Wed, 13 Mar 2024 23:14:50 -0700 Subject: [PATCH 2/3] Add JDBC to dependencies Scoreboard is now functional again! --- BulletHell/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BulletHell/build.gradle b/BulletHell/build.gradle index f248c32..f3660d6 100644 --- a/BulletHell/build.gradle +++ b/BulletHell/build.gradle @@ -8,6 +8,10 @@ repositories { mavenCentral() } +dependencies { + implementation 'org.xerial:sqlite-jdbc:3.30.1' +} + javafx { version = '17' modules = [ 'javafx.controls', 'javafx.media' ] From 8e38be556fee71cd7856767b9c855f92faeb17f3 Mon Sep 17 00:00:00 2001 From: Swap Date: Thu, 14 Mar 2024 00:43:32 -0700 Subject: [PATCH 3/3] Fix folder structure and add jar command Jars can now be built with `gradle shadowJar` --- BulletHell/build.gradle | 20 +++++++++--------- .../src/{ => main/java}/AudioPlayer.java | 4 ++++ BulletHell/src/{ => main/java}/Bullet.java | 0 .../src/{ => main/java}/BulletSpawner.java | 0 BulletHell/src/{ => main/java}/Character.java | 0 .../src/{ => main/java}/DatabaseDriver.java | 0 BulletHell/src/{ => main/java}/HellGirl.java | 0 BulletHell/src/{ => main/java}/Main.java | 4 ++-- .../main/resources}/database/scoresdb.sqlite | Bin .../main/resources}/images/blueBullet.png | Bin .../main/resources}/images/chibi.png | Bin .../main/resources}/images/cyanBullet.png | Bin .../main/resources}/images/gameOver.png | Bin .../main/resources}/images/girlTitle.png | Bin .../main/resources}/images/greenBullet.png | Bin .../main/resources}/images/hellTitle.png | Bin .../main/resources}/images/leftFlight.png | Bin .../main/resources}/images/lives.png | Bin .../main/resources}/images/orangeBullet.png | Bin .../main/resources}/images/redBullet.png | Bin .../main/resources}/images/rightFlight.png | Bin .../main/resources}/images/rounds.png | Bin .../main/resources}/images/score.png | Bin .../main/resources}/images/startGlow.png | Bin .../main/resources}/images/straightFlight.png | Bin .../main/resources}/images/topScores.png | Bin .../main/resources}/images/whiteBullet.png | Bin .../main/resources}/images/yellowBullet.png | Bin .../main/resources}/sounds/cursorHover.wav | Bin .../main/resources}/sounds/death.wav | Bin .../main/resources}/sounds/gameMusic.wav | Bin .../main/resources}/sounds/select.wav | Bin .../main/resources}/sounds/wind.wav | Bin 33 files changed, 16 insertions(+), 12 deletions(-) rename BulletHell/src/{ => main/java}/AudioPlayer.java (95%) rename BulletHell/src/{ => main/java}/Bullet.java (100%) rename BulletHell/src/{ => main/java}/BulletSpawner.java (100%) rename BulletHell/src/{ => main/java}/Character.java (100%) rename BulletHell/src/{ => main/java}/DatabaseDriver.java (100%) rename BulletHell/src/{ => main/java}/HellGirl.java (100%) rename BulletHell/src/{ => main/java}/Main.java (99%) rename BulletHell/{res => src/main/resources}/database/scoresdb.sqlite (100%) rename BulletHell/{res => src/main/resources}/images/blueBullet.png (100%) rename BulletHell/{res => src/main/resources}/images/chibi.png (100%) rename BulletHell/{res => src/main/resources}/images/cyanBullet.png (100%) rename BulletHell/{res => src/main/resources}/images/gameOver.png (100%) rename BulletHell/{res => src/main/resources}/images/girlTitle.png (100%) rename BulletHell/{res => src/main/resources}/images/greenBullet.png (100%) rename BulletHell/{res => src/main/resources}/images/hellTitle.png (100%) rename BulletHell/{res => src/main/resources}/images/leftFlight.png (100%) rename BulletHell/{res => src/main/resources}/images/lives.png (100%) rename BulletHell/{res => src/main/resources}/images/orangeBullet.png (100%) rename BulletHell/{res => src/main/resources}/images/redBullet.png (100%) rename BulletHell/{res => src/main/resources}/images/rightFlight.png (100%) rename BulletHell/{res => src/main/resources}/images/rounds.png (100%) rename BulletHell/{res => src/main/resources}/images/score.png (100%) rename BulletHell/{res => src/main/resources}/images/startGlow.png (100%) rename BulletHell/{res => src/main/resources}/images/straightFlight.png (100%) rename BulletHell/{res => src/main/resources}/images/topScores.png (100%) rename BulletHell/{res => src/main/resources}/images/whiteBullet.png (100%) rename BulletHell/{res => src/main/resources}/images/yellowBullet.png (100%) rename BulletHell/{res => src/main/resources}/sounds/cursorHover.wav (100%) rename BulletHell/{res => src/main/resources}/sounds/death.wav (100%) rename BulletHell/{res => src/main/resources}/sounds/gameMusic.wav (100%) rename BulletHell/{res => src/main/resources}/sounds/select.wav (100%) rename BulletHell/{res => src/main/resources}/sounds/wind.wav (100%) diff --git a/BulletHell/build.gradle b/BulletHell/build.gradle index f3660d6..1cbbc8e 100644 --- a/BulletHell/build.gradle +++ b/BulletHell/build.gradle @@ -2,6 +2,7 @@ plugins { id 'java' id 'application' id 'org.openjfx.javafxplugin' version '0.1.0' + id 'com.github.johnrengelman.shadow' version '8.1.1' } repositories { @@ -9,7 +10,7 @@ repositories { } dependencies { - implementation 'org.xerial:sqlite-jdbc:3.30.1' + implementation 'org.xerial:sqlite-jdbc:3.44.1.0' } javafx { @@ -18,13 +19,12 @@ javafx { platform = 'win' } -sourceSets { - main { - java { - srcDirs = ['./src'] - } - resources { - srcDirs = ['./res'] - } +application { + mainClass.set("HellGirl") +} + +tasks { + shadowJar { + exclude("module-info.class") } -} \ No newline at end of file +} diff --git a/BulletHell/src/AudioPlayer.java b/BulletHell/src/main/java/AudioPlayer.java similarity index 95% rename from BulletHell/src/AudioPlayer.java rename to BulletHell/src/main/java/AudioPlayer.java index 24bdf7a..aec49ca 100644 --- a/BulletHell/src/AudioPlayer.java +++ b/BulletHell/src/main/java/AudioPlayer.java @@ -1,5 +1,9 @@ import javafx.scene.media.AudioClip; +import java.io.File; +import java.net.URL; +import java.nio.file.Paths; + public class AudioPlayer { private AudioClip cursorHover; private AudioClip gameMusic; diff --git a/BulletHell/src/Bullet.java b/BulletHell/src/main/java/Bullet.java similarity index 100% rename from BulletHell/src/Bullet.java rename to BulletHell/src/main/java/Bullet.java diff --git a/BulletHell/src/BulletSpawner.java b/BulletHell/src/main/java/BulletSpawner.java similarity index 100% rename from BulletHell/src/BulletSpawner.java rename to BulletHell/src/main/java/BulletSpawner.java diff --git a/BulletHell/src/Character.java b/BulletHell/src/main/java/Character.java similarity index 100% rename from BulletHell/src/Character.java rename to BulletHell/src/main/java/Character.java diff --git a/BulletHell/src/DatabaseDriver.java b/BulletHell/src/main/java/DatabaseDriver.java similarity index 100% rename from BulletHell/src/DatabaseDriver.java rename to BulletHell/src/main/java/DatabaseDriver.java diff --git a/BulletHell/src/HellGirl.java b/BulletHell/src/main/java/HellGirl.java similarity index 100% rename from BulletHell/src/HellGirl.java rename to BulletHell/src/main/java/HellGirl.java diff --git a/BulletHell/src/Main.java b/BulletHell/src/main/java/Main.java similarity index 99% rename from BulletHell/src/Main.java rename to BulletHell/src/main/java/Main.java index bf44fa0..9961cca 100644 --- a/BulletHell/src/Main.java +++ b/BulletHell/src/main/java/Main.java @@ -52,7 +52,7 @@ public class Main extends Application{ private boolean gameOver; @Override - public void start(Stage stage){ + public void start(Stage stage) throws URISyntaxException { initialize(stage); createGameInputs(); createGameLoop(); @@ -237,7 +237,7 @@ public void createTitles() try { hellTitle = new ImageView(new Image(getClass().getResource("images/hellTitle.png").toURI().toString())); girlTitle = new ImageView(new Image(getClass().getResource("images/girlTitle.png").toURI().toString())); - startTitle = new ImageView(new Image(getClass().getResource("images/startGlow.png").toURI().toString())); + startTitle = new ImageView(new Image(getClass().getResource("images/startGlow.png").toURI().toString())); gameOverTitle = new ImageView(new Image(getClass().getResource("images/gameOver.png").toURI().toString())); topScoresTitle = new ImageView(new Image(getClass().getResource("images/topScores.png").toURI().toString())); topScoresTitle.setOpacity(0); diff --git a/BulletHell/res/database/scoresdb.sqlite b/BulletHell/src/main/resources/database/scoresdb.sqlite similarity index 100% rename from BulletHell/res/database/scoresdb.sqlite rename to BulletHell/src/main/resources/database/scoresdb.sqlite diff --git a/BulletHell/res/images/blueBullet.png b/BulletHell/src/main/resources/images/blueBullet.png similarity index 100% rename from BulletHell/res/images/blueBullet.png rename to BulletHell/src/main/resources/images/blueBullet.png diff --git a/BulletHell/res/images/chibi.png b/BulletHell/src/main/resources/images/chibi.png similarity index 100% rename from BulletHell/res/images/chibi.png rename to BulletHell/src/main/resources/images/chibi.png diff --git a/BulletHell/res/images/cyanBullet.png b/BulletHell/src/main/resources/images/cyanBullet.png similarity index 100% rename from BulletHell/res/images/cyanBullet.png rename to BulletHell/src/main/resources/images/cyanBullet.png diff --git a/BulletHell/res/images/gameOver.png b/BulletHell/src/main/resources/images/gameOver.png similarity index 100% rename from BulletHell/res/images/gameOver.png rename to BulletHell/src/main/resources/images/gameOver.png diff --git a/BulletHell/res/images/girlTitle.png b/BulletHell/src/main/resources/images/girlTitle.png similarity index 100% rename from BulletHell/res/images/girlTitle.png rename to BulletHell/src/main/resources/images/girlTitle.png diff --git a/BulletHell/res/images/greenBullet.png b/BulletHell/src/main/resources/images/greenBullet.png similarity index 100% rename from BulletHell/res/images/greenBullet.png rename to BulletHell/src/main/resources/images/greenBullet.png diff --git a/BulletHell/res/images/hellTitle.png b/BulletHell/src/main/resources/images/hellTitle.png similarity index 100% rename from BulletHell/res/images/hellTitle.png rename to BulletHell/src/main/resources/images/hellTitle.png diff --git a/BulletHell/res/images/leftFlight.png b/BulletHell/src/main/resources/images/leftFlight.png similarity index 100% rename from BulletHell/res/images/leftFlight.png rename to BulletHell/src/main/resources/images/leftFlight.png diff --git a/BulletHell/res/images/lives.png b/BulletHell/src/main/resources/images/lives.png similarity index 100% rename from BulletHell/res/images/lives.png rename to BulletHell/src/main/resources/images/lives.png diff --git a/BulletHell/res/images/orangeBullet.png b/BulletHell/src/main/resources/images/orangeBullet.png similarity index 100% rename from BulletHell/res/images/orangeBullet.png rename to BulletHell/src/main/resources/images/orangeBullet.png diff --git a/BulletHell/res/images/redBullet.png b/BulletHell/src/main/resources/images/redBullet.png similarity index 100% rename from BulletHell/res/images/redBullet.png rename to BulletHell/src/main/resources/images/redBullet.png diff --git a/BulletHell/res/images/rightFlight.png b/BulletHell/src/main/resources/images/rightFlight.png similarity index 100% rename from BulletHell/res/images/rightFlight.png rename to BulletHell/src/main/resources/images/rightFlight.png diff --git a/BulletHell/res/images/rounds.png b/BulletHell/src/main/resources/images/rounds.png similarity index 100% rename from BulletHell/res/images/rounds.png rename to BulletHell/src/main/resources/images/rounds.png diff --git a/BulletHell/res/images/score.png b/BulletHell/src/main/resources/images/score.png similarity index 100% rename from BulletHell/res/images/score.png rename to BulletHell/src/main/resources/images/score.png diff --git a/BulletHell/res/images/startGlow.png b/BulletHell/src/main/resources/images/startGlow.png similarity index 100% rename from BulletHell/res/images/startGlow.png rename to BulletHell/src/main/resources/images/startGlow.png diff --git a/BulletHell/res/images/straightFlight.png b/BulletHell/src/main/resources/images/straightFlight.png similarity index 100% rename from BulletHell/res/images/straightFlight.png rename to BulletHell/src/main/resources/images/straightFlight.png diff --git a/BulletHell/res/images/topScores.png b/BulletHell/src/main/resources/images/topScores.png similarity index 100% rename from BulletHell/res/images/topScores.png rename to BulletHell/src/main/resources/images/topScores.png diff --git a/BulletHell/res/images/whiteBullet.png b/BulletHell/src/main/resources/images/whiteBullet.png similarity index 100% rename from BulletHell/res/images/whiteBullet.png rename to BulletHell/src/main/resources/images/whiteBullet.png diff --git a/BulletHell/res/images/yellowBullet.png b/BulletHell/src/main/resources/images/yellowBullet.png similarity index 100% rename from BulletHell/res/images/yellowBullet.png rename to BulletHell/src/main/resources/images/yellowBullet.png diff --git a/BulletHell/res/sounds/cursorHover.wav b/BulletHell/src/main/resources/sounds/cursorHover.wav similarity index 100% rename from BulletHell/res/sounds/cursorHover.wav rename to BulletHell/src/main/resources/sounds/cursorHover.wav diff --git a/BulletHell/res/sounds/death.wav b/BulletHell/src/main/resources/sounds/death.wav similarity index 100% rename from BulletHell/res/sounds/death.wav rename to BulletHell/src/main/resources/sounds/death.wav diff --git a/BulletHell/res/sounds/gameMusic.wav b/BulletHell/src/main/resources/sounds/gameMusic.wav similarity index 100% rename from BulletHell/res/sounds/gameMusic.wav rename to BulletHell/src/main/resources/sounds/gameMusic.wav diff --git a/BulletHell/res/sounds/select.wav b/BulletHell/src/main/resources/sounds/select.wav similarity index 100% rename from BulletHell/res/sounds/select.wav rename to BulletHell/src/main/resources/sounds/select.wav diff --git a/BulletHell/res/sounds/wind.wav b/BulletHell/src/main/resources/sounds/wind.wav similarity index 100% rename from BulletHell/res/sounds/wind.wav rename to BulletHell/src/main/resources/sounds/wind.wav