This is my robot that is programmed to hunt and kill its sworn enemy a red plastic cup it is the ballshooter build from the mindstorms NXT 2.0 set but with a little add on the NXTcam from Mindsensors.com it is a special camera for the Mindstorms brick that can return x,y coordinates and area of a pre-programmed color in this case it is Red. The program tells the robot to find the biggest red object and give me its coordinates, through that it determines whether the cup is to the left or right of the robot and moves accordingly. Once the robot has decided it is on target it adjusts for distance by backing up or going forwards. It can give a relative distance (But in no way accurate) by the objects area then once its lined up and at the correct distance it checks to see if the object has moved again then if it hasn't it fires!
I also intend to comment my code and post it soon.