danpost wrote...
All in all, in hook class, using the following is easier:
if (isTouching(Bottle.class)) { removeTouching(Bottle.class); ((MyWorld)getWorld()).getCounter().bumpCounter(1); }
if (isTouching(Bottle.class)) { removeTouching(Bottle.class); ((MyWorld)getWorld()).getCounter().bumpCounter(1); }
import greenfoot.*; public class Bottle extends Actor { public void act() { move(2); if (Greenfoot.getRandomNumber(10)<1) turn (Greenfoot.getRandomNumber(91)-45); if (isAtEdge()) turn(180); if (getY() < 360) setLocation(getX(), 360); } }
import greenfoot.*; public class Bottle extends Actor { public void act() { move(2); if ( Greenfoot.getRandomNumber(10)<1) turn (Greenfoot.getRandomNumber(91)-45); if (isAtEdge()) turn(180); if (getY() < 360) setLocation(getX(), 360); } }