const util = require('util');
const EventEmitter = require('events');

function Tomato(context, center, direction, speed) {
  EventEmitter.call(this);
  this.context = context;
  this.center = center || { x: center.x, y: center.y };
  this.size = 10;
  this.direction = direction || 0;
  this.speed = speed || 3;
}

util.inherits(Tomato, EventEmitter);

Tomato.prototype.draw = function() {
  this.context.fillStyle = 'red';
  this.context.beginPath();
  this.context.arc(this.center.x, this.center.y, this.size, 0, Math.PI * 2, true);
  this.context.closePath();
  this.context.fill();
  return this;
};

Tomato.prototype.velocity = function () {
	return {xv: Math.cos(this.direction) * this.speed, yv: Math.sin(this.direction) * this.speed}
}

Tomato.prototype.updatePosition = function () {
	this.center.x += this.velocity().xv;
	this.center.y += this.velocity().yv;
	return this;
}

module.exports = Tomato;

@@ -880,16 +880,536 @@
 his;%0A%7D%0A%0A
+function distanceBetween(coordinateObject, otherCoordinateObject) %7B%0A  xDistance = coordinateObject.x - otherCoordinateObject.x;%0A  yDistance = coordinateObject.y - otherCoordinateObject.y;%0A  return (Math.sqrt((xDistance * xDistance) + (yDistance * yDistance)));%0A%7D%0A%0A//Checks for collision with the face. Emits a 'collision' event if detected.%0ATomato.prototype.on('faceLocation', function (position, faceSize) %7B%0A  if ( distanceBetween(this.center, position) %3C (this.size + faceSize) ) %7B%0A    this.emit('collision');%0A  %7D%0A%7D)%0A%0A
 module.e

Add distanceBetween function, event listener for 'faceLocation' on Tomato