I am having a problem where I do everything exactly as the tutorial that teaches you how to make a crab eat worms, says, (except for a couple name changes) n=but it gives me a "cannot find symbol- variable spider. here is my code:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class blue_car here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class blue_car extends Actor
{
/**
* Act - do whatever the blue_car wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
{
if(Greenfoot.isKeyDown("d"))
turn(1);
}
if(Greenfoot.isKeyDown("a"))
{
turn(-1);
}
if(Greenfoot.isKeyDown("w"))
{
move(1);
}
if(Greenfoot.isKeyDown("s"))
{
move(-1);
}
{ if(Greenfoot.isKeyDown("right"))
{
turn(1);
}
if(Greenfoot.isKeyDown("left"))
{
turn(-1);
}
if(Greenfoot.isKeyDown("up"))
{
move(1);
}
if(Greenfoot.isKeyDown("down"))
{
move(-1);
}
/**
* Eat a spider.
*/
{
Actor leaf = getOneObjectAtOffset(0, 0, spider.class);
if(spider != null) {
getWorld().removeObject(spider);
spidersEaten = spidersEaten + 1;
}
}
}
}
}

