import java.awt.*;

/** NegativeFollower changes the color map of the image every time it
    is touched.  It does a photo-negative on the image on each call to
    touch(x,y)
*/
public class NegativeFollower extends Follower {

  /** Constructor to display Image img along Path p.
    */
  public NegativeFollower(String name, Image img, Path p) {
    super(name, img, p);
  }
  

  /** Sprite touch method.  
      Has the side effect of photo-negativing the image.
      @see Sprite#touch
  */
  public boolean touch(int x, int y) {
    if (super.touch(x,y)) {
      for (int i=0; i<pixel.length; i++) {
	pixel[i] ^= 0x00ffffff;
      }
      // System.out.println("OOH!  Ya got me! " + getName());
      return true;
    }
    return false;
  }

}
