This is a minor problem, when I shoot and hit a tree it stops the world. I made a couple changes to my code that could have caused this. It worked fine before. Here is my code for the bullet, (where i changed things)
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 boolean exsists = true;
public static int kills;
private int gunCoolDown;
private int speed = -15;
public Survivor ethan;
public Bullet(int direction)
{
setRotation(direction);
}
public void act()
{
move(speed);
bulletTree();
if ((this) !=null)
{
if (canSee (Zombie.class))
{
kill(Zombie.class);
exsists = false;
}
if (exsists)
{
checkEdges();
}
}
}
public void kill(Class clss)
{
Actor actor = getOneObjectAtOffset(0,0, clss);
if(actor != null)
{
getWorld().removeObject(actor);
getWorld().removeObject(this);
Survivor.score += 1;
}
}
public boolean canSee(Class clss)
{
Actor actor = getOneObjectAtOffset(0,0, clss);
return actor != null;
}
public void checkEdges()
{
if (atWorldEdge())
{
getWorld().removeObject(this);
}
}
public boolean atWorldEdge()
{
if(getX() < 10 || getX() > getWorld().getWidth() - 10)
return true;
if(getY() < 10 || getY() > getWorld().getHeight() - 10)
return true;
else
return false;
}
public void bulletTree()
{
if (canSee (Tree.class))
{
getWorld().removeObject(this);
}
}
}

