KCee wrote...
im not really sure what you mean by stacktrace but this is what it says:
1 2 3 4 5 6 7 | public boolean isGrabbed() { final VehicleWorld world = (VehicleWorld)getWorld(); if (world == null ) { return false ; } return world.isGrabbed( this ); } |
KCee wrote...
java.lang.ClassCastException: class GoodWitch cannot be cast to class Villager (GoodWitch and Villager are in unnamed module of loader java.net.URLClassLoader @786b6cc9)
at PoisonCloud.act(PoisonCloud.java:29)
at greenfoot.core.Simulation.actActor(Simulation.java:567)
at greenfoot.core.Simulation.runOneLoop(Simulation.java:530)
at greenfoot.core.Simulation.runContent(Simulation.java:193)
at greenfoot.core.Simulation.run(Simulation.java:183)1 2 3 | if (touched instanceof Villager && ((Villager)touched).isGrabbed()) { continue ; } |
1 2 3 4 5 6 7 | for (Object obj : getIntersectingObjects(Villager. class )) { Villager villager = (Villager)obj; if ( ! villager.isGrabbed()) { getWorld().removeObject(villager); break ; } } |