   draw_colission:(x, y) ->
     color = '#0000a0'
     @context.fillStyle = color
-    @draw_ellipse(x, y, 35, 25)
-
-  draw_ellipse:(x, y, w, h) ->
-    kappa = .5522848;
-    ox = (w / 2) * kappa
-    oy = (h / 2) * kappa
-    xe = x + w
-    ye = y + h
-    xm = x + w / 2
-    ym = y + h / 2
-
-    @context.beginPath();
-    @context.moveTo(x, ym);
-    @context.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y);
-    @context.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym);
-    @context.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);
-    @context.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym);
-    @context.closePath();
-    @context.fill()
+    shape = new Shape(@context)
+    shape.draw_ellipse(x, y, 35, 25)
+
 class Sun
   constructor:(context) ->
     @mouth = true


  draw_as_dead: ->
    @context.fillStyle = '#0000a0'
    @draw_ellipse(@x-@width, @y, 2.5*@explosion_width, @explosion_height)

  animate_colission:() ->
    @context.fillStyle = '#F50B0B'

    @context.beginPath()
    @context.arc x, y, width, 0, Math.PI*2, true
    @context.closePath()
    @context.fill()

  draw_ellipse:(x, y, w, h) ->
    kappa = .5522848;
    ox = (w / 2) * kappa
    oy = (h / 2) * kappa
    xe = x + w
    ye = y + h
    xm = x + w / 2
    ym = y + h / 2

    @context.beginPath();
    @context.moveTo(x, ym);
    @context.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y);
    @context.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym);
    @context.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);
    @context.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym);
    @context.closePath();
    @context.fill()

class Building
