 
   return
 
+# obstacle graphics
+renderMine = (ctx) ->
+    ctx.fillStyle = 'black'
+    ctx.strokeStyle = 'white'
+    ctx.lineWidth = 1
+
+    ctx.beginPath()
+    ctx.moveTo(-cell_size*.35,-cell_size*.35)
+    ctx.lineTo(cell_size*.35,cell_size*.35)
+    ctx.moveTo(cell_size*.35,-cell_size*.35)
+    ctx.lineTo(-cell_size*.35,cell_size*.35)
+
+    ctx.moveTo(0,-cell_size*.4)
+    ctx.lineTo(0,cell_size*.4)
+    ctx.moveTo(cell_size*.4,0)
+    ctx.lineTo(-cell_size*.4,0)
+    ctx.stroke()
+
+    ctx.beginPath()
+    ctx.arc(0,0, cell_size*.3, 0, Math.PI*2)
+    ctx.fill()
+    ctx.stroke()
+
+    return
+ 
 # general directions
 UP = (theta: Math.PI/2, dx: 0, dy: -1)
 LEFT = (theta: Math.PI, dx: -1, dy: 0)

  click: clickControlPanel

control_panel = setupControlPanel()
level_state = setupLevel((xi:0, yi:5, dir:0), (xi:6, yi:5))

stop = false


  render: renderUndoButton
  action: undoButtonAction

# obstacles
class Static_obstacle
  constructor: (@xi, @yi) ->

  render: (ctx, frame, frame_t, t) ->
    ctx.save()
    ctx.translate((@xi + .5)*cell_size+.5, (@yi + .5)*cell_size+.5)

    renderMine(ctx)
    ctx.restore()
    return

  isHit: (xi, yi, frame) ->
    return xi == @xi and yi == @yi

class Mobile_obstacle
  constructor: (@xi, @yi, @dxi, @dyi) ->

  render: (ctx, frame, frame_t, t) ->
    distx = (frame + frame_t) * @dxi
    disty = (frame + frame_t) * @dyi

    ctx.save()

    ctx.translate((@xi + .5 + distx)*cell_size+.5,
                  (@yi + .5 + disty)*cell_size+.5)

    renderMine(ctx)
    ctx.restore()
    return

  isHit: (xi, yi, frame) ->
    # NOTE: if the obstacle is to move more than one cell per frame in some
    # direction, this check will need to be expanded
    return xi == @xi+frame*@dxi and yi == @yi+frame*@dyi

# level logic

levelMode =
  STOP: 1
