You should use 'seePaint(String)' method where the string is either "red", "orange", or "purple". The method returns a boolean (true/false) value indicating whether the greep currently sees paint of that color (the method is found in and inherited to the Greep class from the Creature class). Use it as an 'if' condition to do whatever you might do to attempt to follow the trail (I used the word 'attempt' because greeps are fairly limited in what they are capable of).
oh i wrote deop instead of spit XD
i should use like this?
public boolean seePaint(String "color")
{
List paintDrops = getIntersectingObjects(Paint.class);
for(Object obj : paintDrops) {
if ( ((Paint)obj).getColor().equals(color)) {
return true;
}
}
return false;
}
That looks very similar to the method that is already in the Creature class that you can use directly in the Greep class. The only difference is that there are no double quotes around 'color' in the first line. You do not need to re-write the method in the Greep class -- as I said, because Greeps extends the Creature class, the method is inherited (becomes part of the Greep class). You only need to create an 'if' block within the act method of your Greep class using the method in its conditional expression. For example: