I'm trying to make a method that tells you if there is a specific Object at a specific location
I've seen this with List a few times now but when I use it it doesn't work. Greenfoot tells me that List is no actor. So I'm wondering do I need to create a List or do I need to import something so that this will work
1 2 3 4 5 6 7 8 | public boolean occupied( int x, int y, Class clls){ List objects = getWorld().getObjectsAt(x, y, clls); if (objects.isEmpty){ return false ; } else { return true ;} } |