Hi,
when the tie fighter collides with an asteroid the tie fighter should be removed. now i have an enemy (TieEnemy) and i have the same if-statement. but when it collides with the tieenemy i have the nullpointerexception problem
Code of the tie fighter:
code of "public void gameOver" in the main world:
thanks
if (isTouching(Asteroid2.class)){
((TieWorld)getWorld()).gameOver();
}
else
if (isTouching(TieEnemy.class)){
((TieWorld)getWorld()).gameOver();
getWorld().removeObject(tieenemy); //here is the NullPointerException problem
}
public void gameOver (){
backgroundMusic.stop();
stopped();
gameover.play();
int x = tie.getX();
int y = tie.getY();
addObject(new KleineExplosion(), x, y);
removeObject(tie);
addObject(new GameOverScreen(), 450, 300);
}
