Hi, I'm currently writing a game which requires a rocket to shoot a bullet. Currently the bullet gets shot but it leaves and image of the bullet behind of where the actor was places. Any ideas how to solve this. I have included the code
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Bullet here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Bullet extends Actor
{
private int direction, speed;
public boolean atWorldEdge()
{
if(getX() < 20 || getX() > getWorld().getWidth() - 20)
return true;
if(getY() < 20 || getY() > getWorld().getHeight() - 20)
return true;
else
return false;
}
public Bullet(int dir)
{
direction = dir;
speed = 10;
}
public void act()
{
setLocation(getX(), getY() - speed);
if(atWorldEdge()==true)
{
getWorld().removeObject(this);
}
}
public Bullet()
{
{
GreenfootImage image = getImage();
image.scale(image.getWidth() - 160, image.getHeight() - 200);
setImage(image);
}
}
}

