def mystandup() 
{
   	legH1.val =  0 time:1000 &
    	legH2.val =  0 time:1000 &
    	legH3.val =  30 time:1000 &
	legF1.val =   0 time:1000 &
	legF2.val =   0 time:1000 &
	legF3.val =   30 time:1000 &
	tailTilt.val = 2 time:1000 &
	tailPan.val = 0 time:1000 &
	head.val = 0 time:1000;
};

motor on;
robot.initial();
mystandup();
camera.wb = 1;
talk=0;
ball.a = 0.95; 
whenever (ball.visible) 
{
    headPan  = headPan  + ball.a * camera.xfov * ball.x &
    headTilt = headTilt + ball.a * camera.yfov * ball.y &
    ledF14=1;
   if (headPan.val > 20)
	robot.turn (-10)
  else
    if (headPan.val < -20)
	robot.turn (10)
  else
    if (distance.val > 100)
	{
	talk=0; 
	robot.walk(20)
	}
    else
	talk = talk + 1;
      if (talk==300)
		speaker.play ("takethep.wav");

}
else ledF14=0,