Browse Source

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

cognitivegears 2 years ago
parent
commit
e90aa49444

+ 2
- 0
.gitignore View File

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

+ 2
- 1
README.md View File

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

+ 3
- 3
pom.xml View File

@@ -4,7 +4,7 @@
4 4
 
5 5
     <groupId>com.droidquest</groupId>
6 6
     <artifactId>dq</artifactId>
7
-    <version>1.1-SNAPSHOT</version>
7
+    <version>1.2</version>
8 8
     <packaging>jar</packaging>
9 9
 
10 10
     <name>DroidQuest</name>
@@ -22,8 +22,8 @@
22 22
                 <artifactId>maven-compiler-plugin</artifactId>
23 23
                 <version>3.3</version>
24 24
                 <configuration>
25
-                    <source>5</source>
26
-                    <target>5</target>
25
+                    <source>1.6</source>
26
+                    <target>1.6</target>
27 27
                 </configuration>
28 28
             </plugin>
29 29
             <plugin>

+ 1
- 1
src/com/droidquest/items/GateKeeper.java View File

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

+ 5
- 3
src/com/droidquest/items/Sentry.java View File

@@ -240,9 +240,11 @@ public class Sentry extends Item {
240 240
 
241 241
         if (behavior == -1) {
242 242
             if (carrying == null) {
243
-                x = robot.x + robot.width / 2 - width / 2;
244
-                y = robot.y + robot.height / 2 - height / 2;
245
-                PicksUp(robot);
243
+                if(robot != null) {
244
+                    x = robot.x + robot.width / 2 - width / 2;
245
+                    y = robot.y + robot.height / 2 - height / 2;
246
+                    PicksUp(robot);
247
+                }
246 248
             }
247 249
         }
248 250
 

+ 1
- 1
src/com/droidquest/materials/BatteryIn.java View File

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

+ 1
- 0
start.bat View File

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

+ 45
- 0
start.sh View File

@@ -0,0 +1,45 @@
1
+#/bin/sh
2
+
3
+RUNPRG="java"
4
+if ! type -p "${RUNPRG}" > /dev/null;
5
+then
6
+  if [ -n "${JAVA_HOME}" ];
7
+  then
8
+    RUNPRG="${JAVA_HOME}/bin/java"
9
+    if [ ! -x "${RUNPRG}" ];
10
+    then
11
+      echo "JAVA_HOME set, but unable to find java.  Please check your java installation."
12
+      exit 1
13
+    fi
14
+  else
15
+    echo "Java 1.6 or newer needed for DQ.  Must be in PATH or JAVA_HOME set."
16
+    exit 1
17
+  fi
18
+fi
19
+
20
+
21
+if [ -f "target/dq-1.2.jar" ];
22
+then
23
+  echo "Starting DQ."
24
+  ${RUNPRG} -jar "target/dq-1.2.jar"
25
+else
26
+  echo "No jar found, building DQ before running."
27
+  MVNPRG="mvn"
28
+  if ! type -p "${MVNPRG}" > /dev/null;
29
+  then
30
+    if [ -n "${MAVEN_HOME}" ];
31
+    then
32
+      MVNPRG="${MAVEN_HOME}/bin/mvn"
33
+      if [ ! -x "${MVNPRG}" ];
34
+      then
35
+        echo "MAVEN_HOME set, but unable to find mvn executable. Please check your maven installation."
36
+        exit 1
37
+      fi
38
+    else
39
+      echo "Maven required to build DQ.  See maven.apache.org to download."
40
+      exit 1
41
+    fi
42
+  fi
43
+  ${MVNPRG} package
44
+  ${MVNPRG} exec:java -Dexec.mainClass=com.droidquest.DQ
45
+fi

+ 0
- 1
start_game.sh View File

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

Loading…
Cancel
Save