What is wrong with this code if ( canSee(Fly.class) ) that it gives me some message "cannot find symbol-method canSee (java.lang. Class<Fly>) .
public void eat()
{
Actor food;
food = getOneObjectAtOffset(0,0, food.class);
if (food != null)
{
World world;
world = getWorld();
world.removeObject(food);
}import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class me here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class me extends Actor
{
public void act()
{
lookforsmting();
if (thing != null)
{
eat();
}
}
public void lookforsmting()
{
Actor thing;
thing = getOneObjectAtOffset(0,0, thing.class);
}
public void eat()
{
World world;
world = getWorld();
world.removeObject(thing);
}
}
return thing;
Actor thing = lookforsmting();
eat(thing);
public void eat(Actor thing)
import greenfoot.*
public class Me extends Actor // it is customary to begin class names with capital letters
{
public void act()
{
eat();
}
public void eat()
{
Actor thing = getOneIntersectingObject(Thing.class);
if(thing != null) getWorld().removeObject(thing);
}
}