I have whenever objects hit a certain object, they get objects hitting the object get removed and a static int is changed, but it only changes with FireBall.class. Please help.
import greenfoot.*;
public class Center extends Actor
{
public void act()
{
touchStuff();
}
public void touchStuff()
{
if(isTouching(Phantom.class))
{
MyWorld.health = MyWorld.health - 1;
removeTouching(Phantom.class);
}
if(isTouching(Spider.class))
{
MyWorld.health = MyWorld.health - 1;
removeTouching(Spider.class);
}
if(isTouching(FireBall.class))
{
MyWorld.health = MyWorld.health - 1;
removeTouching(FireBall.class);
}
if(isTouching(Vex.class))
{
MyWorld.health = MyWorld.health - 1;
removeTouching(Vex.class);
}
}
}

