Okay It's me again! (sorry for spamming the discussions walls)
for this code, It says that it "cannot find symbol : method canSee(java.lang.Class<lily1>)
for my little crab scenario it worked perfectly fine but not in this scenario?
and I was reading one of the discussions (is there any way to have a dead spot that actors can't enter)
I want to use the code
getObjectsInRange(int radius, java.lang.Class cls)
Return all objects within range 'radius' around this object.
but I have no idea how?? please help!
public void act()
{
if ( canSee(lily1.class))
{
eat(lily1.class);
lily1Eaten = lily1Eaten + 1;
Greenfoot.playSound("slurp.wav");
}
if ( canSee(lily2.class))
{
eat(lily2.class);
lily2Eaten = lily2Eaten + 2;
Greenfoot.playSound(".wav");
}
if ( canSee(lily3.class))
{
eat(lily3.class);
lily3Eaten = lily3Eaten + 3;
Greenfoot.playSound(".wav");
}
if (liliesEaten == 10)
{
Greenfoot.playSound("fanfare.wav");
Greenfoot.stop();
}
if (Greenfoot.isKeyDown("left"))
{
turn(-4);
}
if (Greenfoot.isKeyDown("right"))
{
turn(4);
}
if (Greenfoot.isKeyDown("up"))
{
move(4);
}
if (Greenfoot.isKeyDown("down"))
{
move(-4);
}
}
}

