 
 ###*
 Triggered every time the object should be drawn. A canvas is passed as
-the first argument. 
+the first argument.
 
     player = Core
       x: 0
       y: 10
       width: 5
       height: 5
-    
+
     player.bind "draw", (canvas) ->
       # Text will be drawn positioned relatively to the object.
       canvas.drawText

    scaleY: 1
    zIndex: 0

  setSizeCallback = (sprite) ->
    I.width = sprite.width
    I.height = sprite.height

  if I.sprite?.isString?()
    if I.sprite.indexOf("data:") is 0
      I.sprite = Sprite.fromURL(I.sprite, setSizeCallback)
    else
      I.sprite = Sprite.loadByName(I.sprite, setSizeCallback)

  self.bind 'draw.Drawable', (canvas) ->
    if I.alpha? and I.alpha != 1

      canvas.context().globalAlpha = I.alpha

    if sprite = I.sprite
      if sprite.draw?
        sprite.draw(canvas, -sprite.width / 2, -sprite.height / 2)
      else
        warn?("Sprite has no draw method!")
