In class we are trying to create a rocket game where the rocket shoots bullets. If I add the bullet in manullay it shows up as it should, a small yellow rectangle. However when the rocket fires, the only image that shows up is the Greenfoot icon.
This is the Rocket code:
Here is the code in the Bullet:
Any help would be appreciated!
public void fire()
{
if ( Greenfoot.isKeyDown("space") ) {
if (counter==0) {
getWorld().addObject(new Bullet (getRotation()),getX(),getY());
counter = counter + 1;
} else {
if (counter == 15) {
counter = 0;
} else {
counter = counter +1;
}
}
} else {
counter = 0;
}
}public Bullet()
{
GreenfootImage image = new GreenfootImage(8,20);
image.setColor(java.awt.Color.YELLOW);
image.fillRect(0,0,8,2);
setImage(image);
}

