I am trying to get the fireball to move in a direction specific to which image is currently being used but it won't move. I want it to fire in one direction if the pig image if pointing one way and then fire in the opposite direction if the pig image is pointing the other way. Help!
public class Fireball extends Actor
{
private GreenfootImage image1;
private GreenfootImage image2;
public Fireball()
{
image1 = new GreenfootImage("pigCopy.png");
image2 = new GreenfootImage("pig.png");
public int getY();
public int getX();
}
/**
* Act - do whatever the Fireball wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
if (getImage()== image1)
{
getWorld().addObject(new Fireball(), getX() - 10, getY());
}
if (getImage()== image2)
{
getWorld().addObject(new Fireball(), getX() + 10, getY());
}
if (getX()>=getWorld().getWidth()-1)
{
getWorld().removeObject(this);
}
}
}


