danpost wrote...
SushiLlama wrote...
(deleted) i wonder why i get NullPointerExceptions in line 13 in Turret.class.
<< Codes Omitted >>
protected Shell[] shells = new Shell[5];
public Tank() {
for(int i=0;i<shells.length;i++) {
//shells[i] = new Shell(this);
}
}
public void shoot() {
if(shells!=null) {
System.out.println("My Ammo isnt empty"+shells.length);
for(int i=0;i<shells.length;i++) {
if(shells[i]!=null) {
Shell shootShell = shells[i];
shootShell.executeShell(); //move the shell bla bla
shells[i] = null;
break;
}
}
}
}
