For a project at school we need to program a game in JavaFx, we're almost ready with the game but I get a strange error when I use the intersects command (see attachment 1) error section. In the second and third attachment are the constructors which I use in those line where the error is constructor_1 constructor_2. and the last attachment is the ouput window with the error lines output_window_with_error_lines.
I already have read the section on this site over NullPointerException
but I cant find the fault.
Main code:
if (kogelView.getBoundsInParent().intersects(enemyView1.getBoundsInParent()))
{
enemyDoodModel1.setXDodeEnemy(enemyModel1.getX());
enemyDoodView1.UpdateEnemyDood(enemyDoodModel1);
enemyDoodModel2.setXDodeEnemy(enemyModel2.getX());
enemyDoodView2.UpdateEnemyDood(enemyDoodModel2);
}
}
constructor_1:
public void setXDodeEnemy(int xPos)
{
this.xDood = xPos;
}
constructor_2:
public int getX()
{
return this.xEnemy;
}