Hey,
I creating a game, where you can shoot on enemys (Spider) and i want to remove the Spider if i hit it. I used this code in the Laser class (The shots which hit the Spiders):and this code in the Overclass of the Laser class:
When I start the game, it crashes if the Laser hit the edge of the map, why???
Im sure that it is because of one of These codes, because without them it works.
Thank you very much
public void remove() { if (canSee(Spider.class) ) { remove(Spider.class); } }
public boolean canSee(Class clss) { Actor actor = getOneObjectAtOffset(0, 0, clss); return actor != null; } public void remove(Class clss) { Actor actor = getOneObjectAtOffset(0, 0, clss); if(actor != null) { getWorld().removeObject(actor); return; } }