           shark.hasAttacked = true
           $scope.raft.takeBite()
 
+    # Then spawn extra sharks
+    $scope.updatesUntilNextShark--
+    if $scope.updatesUntilNextShark <= 0
+      $scope.spawnShark()
+      $scope.updatesUntilNextShark = 1/$scope.sharksPerSecond/$scope.step
+
+
+  # Called once per animation frame, will update the game model as many times
+  # as necessary before allowing it to be drawn to the screen
   $scope.frame = ->
     $scope.$apply ->
       now = timestamp()

#TODO check this works everywhere
timestamp = -> window.performance.now()

class Entity
  constructor: (@x, @y, @velocityX, @velocityY) ->


  $scope.raft = new Raft($scope.raftHitPoints)
  $scope.sharks = []
  $scope.updatesUntilNextShark = 0

  $scope.dt = 0
  $scope.last = timestamp()
