diff --git a/.gitignore b/.gitignore
index 4cb7b24..58add36 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
*.lvl
*.class
target/
+.idea/
+*.iml
diff --git a/README.md b/README.md
index 48b5c28..74083e9 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,8 @@ Build with:
Run the game:
- ./start_game.sh
+ MacOSX / Linux: ./start.sh
+ Windows: start.bat (IN PROGRESS)
OR
java -jar target/dq-1.1-SNAPSHOT.jar
diff --git a/pom.xml b/pom.xml
index 13b9136..b49096a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.droidquest
dq
- 1.1-SNAPSHOT
+ 1.2
jar
DroidQuest
@@ -22,8 +22,8 @@
maven-compiler-plugin
3.3
-
- 5
+
+ 1.6
diff --git a/src/com/droidquest/items/GateKeeper.java b/src/com/droidquest/items/GateKeeper.java
index 7ef1b6e..91b5cce 100644
--- a/src/com/droidquest/items/GateKeeper.java
+++ b/src/com/droidquest/items/GateKeeper.java
@@ -64,7 +64,7 @@ public class GateKeeper extends Item {
public void Animate() {
if (behavior == 1) {
- if (x != goToX && y != goToY) {
+ if (x != goToX || y != goToY) {
if (x != goToX) {
int diff = Math.abs(goToX - x);
int dir = diff / (goToX - x);
diff --git a/src/com/droidquest/items/Sentry.java b/src/com/droidquest/items/Sentry.java
index 5e08dc3..a0e7356 100644
--- a/src/com/droidquest/items/Sentry.java
+++ b/src/com/droidquest/items/Sentry.java
@@ -240,9 +240,11 @@ public class Sentry extends Item {
if (behavior == -1) {
if (carrying == null) {
- x = robot.x + robot.width / 2 - width / 2;
- y = robot.y + robot.height / 2 - height / 2;
- PicksUp(robot);
+ if(robot != null) {
+ x = robot.x + robot.width / 2 - width / 2;
+ y = robot.y + robot.height / 2 - height / 2;
+ PicksUp(robot);
+ }
}
}
diff --git a/src/com/droidquest/materials/BatteryIn.java b/src/com/droidquest/materials/BatteryIn.java
index d7fb360..184660d 100644
--- a/src/com/droidquest/materials/BatteryIn.java
+++ b/src/com/droidquest/materials/BatteryIn.java
@@ -13,7 +13,7 @@ import com.droidquest.levels.Level;
public class BatteryIn extends Material {
// Charges the Battery when an Energy Crystal is passed over it.
- public void BatteryIn() {
+ public BatteryIn() {
passable = true;
GenerateIcons();
}
diff --git a/start.bat b/start.bat
new file mode 100755
index 0000000..34ec06b
--- /dev/null
+++ b/start.bat
@@ -0,0 +1 @@
+java -jar "target\dq-1.2.jar"
diff --git a/start.sh b/start.sh
new file mode 100755
index 0000000..cad1915
--- /dev/null
+++ b/start.sh
@@ -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
diff --git a/start_game.sh b/start_game.sh
deleted file mode 100755
index 7aff439..0000000
--- a/start_game.sh
+++ /dev/null
@@ -1 +0,0 @@
-mvn exec:java -Dexec.mainClass=com.droidquest.DQ