       speed = 2
       verticalDistanceFromRaft = 100+Math.random()*80
       timeToCollision = verticalDistanceFromRaft/(speed+$scope.raft.forwardSpeed)
-      direction = if $scope.raft.left<$scope.width/2 then 1 else -1
+      direction = if $scope.raft.x<$scope.width/2 then 1 else -1
       yDiff = timeToCollision*speed
       xDiff = timeToCollision*speed*direction
-      y = $scope.raft.top-yDiff
-      x = $scope.raft.left-xDiff
+      y = $scope.raft.y-yDiff
+      x = $scope.raft.x-xDiff
       if y>50
         $scope.sharks.push(new Shark(x, y-20, speed*direction, speed))
 

      console.log "You got eaten!"



sharkAttackApp.controller('SharkAttackCtrl', ['$scope', '$interval', ($scope, $interval) ->

  #TODO make these do something
  $scope.width = 400

    # Then check to see if the raft collides with a shark
    for shark in $scope.sharks
      unless shark.hasAttacked
        if shark.y-20 < $scope.raft.y < shark.y+20 and \
           shark.x-20 < $scope.raft.x < shark.x+20
          shark.hasAttacked = true
          $scope.raft.takeBite()

  $scope.frame = ->
    $scope.$apply ->
