Hello, I'm currently working on a game in which two people fight eachother. I want to make it so, that when my actor (MAND1) has been hit, a reset screen follows. The problems I'm having are whenever I hit the 'run' button, the resetScreen appears instantly, but I only want it to appear, when an actor has intersected with 'Ildkugle'. I have tried the following codes:
This applies to the MAND1 Actor
This applies to the resetScreen world class
public void hitIldkugle()
{
Actor ildkugle = getOneIntersectingObject(Ildkugle.class);
if(ildkugle != null)
{
World myWorld = getWorld();
myWorld.removeObject(this);
}
{
Greenfoot.setWorld(new resetScreen());
}
}
} public void act()
{
if(Greenfoot.isKeyDown("enter"))
Greenfoot.setWorld(new MyWorld());
}
