(function() {
  'use strict';

  function Enemy(game, x, y, health) {
    Phaser.Sprite.call(this, game, x, y, 'enemy');
    this.scale.setTo(0.25,0.25);
    this.game   = game;
    this.health = health;
  }

  Enemy.prototype = Object.create(Phaser.Sprite.prototype);

  Enemy.prototype.update = function() {

  };

  window.Darwinator = window.Darwinator || {};
  window.Darwinator.Enemy = Enemy;

}());
@@ -42,24 +42,32 @@
  Enemy(game,
+ target,
  x, y, healt
@@ -211,111 +211,1166 @@
 ;%0A  
-%7D%0A%0A  Enemy.prototype = Object.create(Phaser.Sprite.prototype);%0A%0A  Enemy.prototype.update = function() %7B
+  this.body.collideWorldBounds = true;%0A    this.target = target;%0A    this.path = null;%0A    this.stamina = 50;%0A    this.currBreath = this.stamina;%0A  %7D%0A%0A  Enemy.prototype = Object.create(Phaser.Sprite.prototype);%0A%0A  Enemy.prototype.setPath = function(path) %7B%0A    console.log(path);%0A    this.path = path;%0A  %7D;%0A%0A  Enemy.prototype.update = function() %7B%0A    var currTile = window.Darwinator.Helpers.pixelsToTile(this.body.x, this.body.y);%0A    var targetTile = window.Darwinator.Helpers.pixelsToTile(this.target.body.x, this.target.body.y);%0A%0A    window.Darwinator.Pathfinder.findPath(currTile%5B0%5D, currTile%5B1%5D, targetTile%5B0%5D, targetTile%5B1%5D, function(path)%7B%0A      this.path = path;%0A    %7D.bind(this));%0A    window.Darwinator.Pathfinder.calculate();%0A%0A    if(this.path !== null) %7B%0A      var targetPos = window.Darwinator.Helpers.tileToPixels(this.path%5B1%5D.x, this.path%5B1%5D.y);%0A      this.game.physics.moveToXY(this, targetPos%5B0%5D, targetPos%5B1%5D, 100);%0A      if(this.path.length %3C 3 && this.currBreath %3E 1) %7B%0A        this.body.velocity.multiply(2,2);%0A        this.currBreath--;%0A      %7D else if (this.currBreath %3C this.stamina) %7B%0A        this.currBreath += 0.2;%0A      %7D%0A    %7D;%0A
 %0A%0A  

Add pathfinding for enemies