Skip to content
Snippets Groups Projects
Commit e40f043b authored by Joseph Walton-Rivers's avatar Joseph Walton-Rivers
Browse files

fixed NPE on cloning ships

parent 185f8ab8
No related branches found
No related tags found
No related merge requests found
...@@ -37,8 +37,6 @@ public class NeuroShip extends GameObject { ...@@ -37,8 +37,6 @@ public class NeuroShip extends GameObject {
static double gravity = 0.0; static double gravity = 0.0;
public Action action;
// position and velocity // position and velocity
public Vector2d d; public Vector2d d;
...@@ -50,7 +48,6 @@ public class NeuroShip extends GameObject { ...@@ -50,7 +48,6 @@ public class NeuroShip extends GameObject {
public NeuroShip copy() { public NeuroShip copy() {
NeuroShip ship = new NeuroShip(s, v, d); NeuroShip ship = new NeuroShip(s, v, d);
ship.action = new Action(action);
ship.releaseVelocity = releaseVelocity; ship.releaseVelocity = releaseVelocity;
return ship; return ship;
} }
...@@ -73,10 +70,6 @@ public class NeuroShip extends GameObject { ...@@ -73,10 +70,6 @@ public class NeuroShip extends GameObject {
// System.out.println("Reset the ship "); // System.out.println("Reset the ship ");
} }
public void update() {
update(action);
}
public NeuroShip update(Action action) { public NeuroShip update(Action action) {
// what if this is always on? // what if this is always on?
...@@ -129,6 +122,11 @@ public class NeuroShip extends GameObject { ...@@ -129,6 +122,11 @@ public class NeuroShip extends GameObject {
return s + "\t " + v; return s + "\t " + v;
} }
@Override
public void update() {
throw new IllegalArgumentException("You shouldn't be calling this...");
}
public void draw(Graphics2D g) { public void draw(Graphics2D g) {
AffineTransform at = g.getTransform(); AffineTransform at = g.getTransform();
g.translate(s.x, s.y); g.translate(s.x, s.y);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment