I get a error saying cannot find symbol- variable my world
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Enemylaser here.
*
*/
public class Enemylaser extends Mover
{
private int life;
/**
* Act - do whatever the Enemylaser wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
move(20.0);
eat();
life--;
if (life == 0)
{
getWorld().removeObject(this);
}
ifAtWorldEdge();
}
public void ifAtWorldEdge()
{
if (atWorldEdge())
{
getWorld().removeObject(this);
}
}
public void eat()
{
Actor Ship;
Ship = getOneObjectAtOffset(0, 0, Ship.class);
if (Ship != null)
{
World world;
world = getWorld();
GameOver gameover = new GameOver();
myWorld.addObject(gameover, myWorld.getWidth()/2, myWorld.getHeight()/2);
world.removeObject(Ship);
}
}
}