   animate_banana:(player) ->
     @timeout = setTimeout (=>
       @draw_scene()
-      this['player_' + player].throw_banana()
+      return if @within_boundaries(player.banana.x(), player.banana.y()) == false
+      player.throw_banana()
 
       @animate_banana(player)
       ),
       150
+
+  within_boundaries:(x, y) ->
+    return false if x < 0 || x > @width || y > @height || y < 0
 
 class Gorilla
   constructor:(@context) ->

    @dy = @force/Math.sin(radian)

  calculate_projection:() ->
    @x += @dx
    @dy -= @g
    @y += @dy

  image:() ->
    image = new Image()


class Banana
  constructor:(@context, @initx, @inity, @force, @angle) ->
    @projection_x = 0
    @projection_y = 0
    @g = 9.8
    @calculate_initial_position()

  x: ->
    @initx + @projection_x

  y: ->
    @inity - @projection_y

  draw: ->
    @context.drawImage @image(), @x(), @y()

  draw_frame: ->
    @draw()
