So i just want a score and thats my script. On world CrabWorldSlither the score works fine, but in crabworld it says NullpointerException. I dont know why and there are no errors in the script so...
My script:
if(getWorld() instanceof CrabWorldSlither){if(isTouching(Craby.class)){this.setLocation(Greenfoot.getRandomNumber(500),
Greenfoot.getRandomNumber(500));
op++;
}}
if (getWorld() instanceof CrabWorld){if(isTouching(Craby.class)){op++; getWorld().removeObject(this); }}
getWorld().showText("Score:"+op, 400,60);
