Hi im making a game where balls comes down from the top and get shot by a bullet. When it gets shot i want to change the current image to another. but cant find a soulotion this is the code i have. i have a PinkBall class and a Bullet class, hope someone can help.
public class Bullet extends Animal
{
private GreenfootImage pinkSplach;
public Bullet()
{
pinkSplach = new GreenfootImage("pinkSplach.png");
}
public void act()
{
hitBall();
}
public void hitBall()
{
Actor actor = getOneIntersectingObject (PinkBall.class);
PinkBall pinkBall = new PinkBall();
if (actor != null)
{
World world = (World)getWorld();
pinkBall.setImage(pinkSplach);
world.removeObject (actor);
world.removeObject (this);
}

