I keep getting an error message because the act method tries to remove the bullet twice....I need to have the bullet removed in both cases.
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
{
/**
* Act - do whatever the Bullet wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
setLocation(getX(), getY()-5);
checkHeight();
checkCollision();
}
private void checkCollision()
{
Actor a = getOneIntersectingObject(Asteroid.class);
Actor b = getOneIntersectingObject(Bullet.class);
if (a != null)
{
World world = getWorld();
world.removeObject(a);
world.removeObject(this);
Greenfoot.playSound("explosion.wav");
}}
private void checkHeight()
{
if(getY()<=37)
{
World world= getWorld();
world.removeObject(this);
}
}
}

