I can shoot actors with lasers. If i hit them the lasers should disappear. I can't remove them completely because then i get NullPointerException errors, so i tried moving them out of sight with "setLocation".
But this somehow doesn't work. Do you know why?
this is the code i used:
- in the laser class:
- in the actor class:
Thanks :)
public void destroyLaser()
{
this.setLocation(899,899);
//getWorld().removeObject(this);
}private void getHit()
{
if (isTouching(Laser.class))
{
((Spielfeld)getWorld()).getLaser().destroyLaser();
health--;
}
}
