I want to make a character respawn after 5 seconds dead.
I'm using this code, is there a way to make the character be added in the world 5 seconds after been removed?
I've tried setLocation(-1000, -1000) + sleepFor(250), to send him away and make him wait but it didn't work as intended
public boolean death() { if(isTouching(Trap.class)) { World myWorld = getWorld(); myWorld.removeObject(this); myWorld.addObject(this, myWorld.getWidth()/2,myWorld.getHeight()/5); return true; } return false; }