Im trying to make this object stop moving if it touches the object "d", and i have been unsuccessful...can anyone pls help me? this is the code of the moving object.
public class Log2 extends Actor
{
public boolean moveX = false;
public void moveLeft()
{ setLocation(getX()-5, getY());
}
public void stop()
{ move(0);}
public void moveRight()
{setLocation(getX()+5, getY()); }
public void act()
{
if(Greenfoot.isKeyDown("LEFT"))
moveLeft();
else if(Greenfoot.isKeyDown("LEFT") || (isTouching(d.class)))
moveX = !moveX; stop();
if(Greenfoot.isKeyDown("RIGHT"))
moveRight();
}

