General clean-up. Fixed GateKeeper, updated startup scripts, fixed warnings.

This commit is contained in:
cognitivegears 2016-10-30 22:09:45 -05:00
parent c341825239
commit e90aa49444
9 changed files with 60 additions and 10 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
*.lvl *.lvl
*.class *.class
target/ target/
.idea/
*.iml

View File

@ -9,7 +9,8 @@ Build with:
Run the game: Run the game:
./start_game.sh MacOSX / Linux: ./start.sh
Windows: start.bat (IN PROGRESS)
OR OR
java -jar target/dq-1.1-SNAPSHOT.jar java -jar target/dq-1.1-SNAPSHOT.jar

View File

@ -4,7 +4,7 @@
<groupId>com.droidquest</groupId> <groupId>com.droidquest</groupId>
<artifactId>dq</artifactId> <artifactId>dq</artifactId>
<version>1.1-SNAPSHOT</version> <version>1.2</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>DroidQuest</name> <name>DroidQuest</name>
@ -22,8 +22,8 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version> <version>3.3</version>
<configuration> <configuration>
<source>5</source> <source>1.6</source>
<target>5</target> <target>1.6</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>

View File

@ -64,7 +64,7 @@ public class GateKeeper extends Item {
public void Animate() { public void Animate() {
if (behavior == 1) { if (behavior == 1) {
if (x != goToX && y != goToY) { if (x != goToX || y != goToY) {
if (x != goToX) { if (x != goToX) {
int diff = Math.abs(goToX - x); int diff = Math.abs(goToX - x);
int dir = diff / (goToX - x); int dir = diff / (goToX - x);

View File

@ -240,9 +240,11 @@ public class Sentry extends Item {
if (behavior == -1) { if (behavior == -1) {
if (carrying == null) { if (carrying == null) {
x = robot.x + robot.width / 2 - width / 2; if(robot != null) {
y = robot.y + robot.height / 2 - height / 2; x = robot.x + robot.width / 2 - width / 2;
PicksUp(robot); y = robot.y + robot.height / 2 - height / 2;
PicksUp(robot);
}
} }
} }

View File

@ -13,7 +13,7 @@ import com.droidquest.levels.Level;
public class BatteryIn extends Material { public class BatteryIn extends Material {
// Charges the Battery when an Energy Crystal is passed over it. // Charges the Battery when an Energy Crystal is passed over it.
public void BatteryIn() { public BatteryIn() {
passable = true; passable = true;
GenerateIcons(); GenerateIcons();
} }

1
start.bat Executable file
View File

@ -0,0 +1 @@
java -jar "target\dq-1.2.jar"

45
start.sh Executable file
View File

@ -0,0 +1,45 @@
#/bin/sh
RUNPRG="java"
if ! type -p "${RUNPRG}" > /dev/null;
then
if [ -n "${JAVA_HOME}" ];
then
RUNPRG="${JAVA_HOME}/bin/java"
if [ ! -x "${RUNPRG}" ];
then
echo "JAVA_HOME set, but unable to find java. Please check your java installation."
exit 1
fi
else
echo "Java 1.6 or newer needed for DQ. Must be in PATH or JAVA_HOME set."
exit 1
fi
fi
if [ -f "target/dq-1.2.jar" ];
then
echo "Starting DQ."
${RUNPRG} -jar "target/dq-1.2.jar"
else
echo "No jar found, building DQ before running."
MVNPRG="mvn"
if ! type -p "${MVNPRG}" > /dev/null;
then
if [ -n "${MAVEN_HOME}" ];
then
MVNPRG="${MAVEN_HOME}/bin/mvn"
if [ ! -x "${MVNPRG}" ];
then
echo "MAVEN_HOME set, but unable to find mvn executable. Please check your maven installation."
exit 1
fi
else
echo "Maven required to build DQ. See maven.apache.org to download."
exit 1
fi
fi
${MVNPRG} package
${MVNPRG} exec:java -Dexec.mainClass=com.droidquest.DQ
fi

View File

@ -1 +0,0 @@
mvn exec:java -Dexec.mainClass=com.droidquest.DQ