Actor not in world can someone help?
Here is my code:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
public class Bullet extends Actor
{
private boolean getAngle = true;
public void act()
{
angleSelect();
move(10);
remove();
}
public void remove()
{
if(getX() >= getWorld().getWidth() -1)
getWorld().removeObject(this);
else if(getX() <= 1)
getWorld().removeObject(this);
else if(getX() >= getWorld().getHeight() -1)
getWorld().removeObject(this);
else if(getX() <= 1)
getWorld().removeObject(this);
}
public void angleSelect()
{
if(getAngle == true)
{
setRotation(Soldier.currentRot);
getAngle = false;
}
}
public void kill()
{
Actor zombie;
zombie = getOneObjectAtOffset(0, 0, Zombie.class);
if (zombie != null)
{
World world;
world = getWorld();
world.removeObject(zombie);
}
}
}