       context.shadowBlur = @shadow.blur
       context.shadowColor = @shadow.color
 
-    context.globalAlpha = @alpha if @alpha < 1
-    context.lineWidth = @lineWidth if context.lineWidth != @lineWidth
-    context.lineJoin = @lineJoin if context.lineJoin != @lineJoin
-
     # Allow sprite objects to have custom draw functions
     if @path != null
         @path(context)
     else
       context.beginPath()
+      # TODO: Handle shadow offset
+      context.translate @size / 2 + @lineWidth / 2, @size / 2 + @lineWidth / 2 # Move to center of canvas
 
       switch @vertices
         when 0

      y: 0
    @solid = false
    @path = null # custom draw function

  ###
   * @description Draw object
   * @param {CanvasRenderingContext2D} context
  ###
  draw: (context, offsetX = 0, offsetY = 0) ->
    offsetX = offsetY = 0 if @fixed

    # Draw child objects first, so they will be on the "bottom"
    super context, @position.x + offsetX, @position.y + offsetY

    context.translate @position.x + offsetX, @position.y + offsetY
    context.scale @scale, @scale if @scale != 1
    context.rotate @rotation if @rotation != 0 && @rotation != Math.PI * 2

    if @shadow.x != null and @shadow.y != null and @shadow.blur != null and @shadow.color != null
      context.shadowOffsetX = @shadow.x

      context.closePath()

      if @solid
        context.fillStyle = @color
        context.fill()
      else
        context.strokeStyle = @color
        context.stroke()

  ###
  @description Draw object
  @param {CanvasRenderingContext2D} context
  ###
  draw: (context, offsetX = 0, offsetY = 0) ->
    offsetX = offsetY = 0 if @fixed

    # Draw child objects first, so they will be on the "bottom"
    super context, @position.x + offsetX, @position.y + offsetY

    # Set scale/rotation/alpha
    context.translate @position.x + offsetX, @position.y + offsetY
    context.scale @scale, @scale if @scale != 1
    context.rotate @rotation if @rotation != 0 && @rotation != Math.PI * 2
    context.globalAlpha = @alpha if @alpha < 1

    # Draw vector shape cache
    context.drawImage @canvas, -@size / 2, -@size / 2

    # Reset scale/rotation/alpha
    context.rotate -@rotation if @rotation != 0 && @rotation != Math.PI * 2
