       
     draw: (c) -> 
       block.draw(c) for block in @blocks
+      
+    contains: (x,y) ->
+      for block in @blocks
+        if block.x == x && block.y == y
+          console.log('collision!!!!!!!!!!')
+          return true 
+      return false
       
   class Tetris.Block
     constructor: (opts={})->

      gs.addEntity(@blocks)
      pusher.connection.bind 'connected', ->
        gs.addEntity(Tetris.Shape.randomShape(x:0, y:0, color: {r:0, g:0, b:0}, owned: true))
  class Level
    constructor: ->
    draw: () ->

    keyDown_38: ->
      return unless @owned
      if @rotation is 3
        newRotation = 0
      else
        newRotation = @rotation + 1
      if @canMoveTo(0,0,newRotation)
        @rotation = newRotation
        @moved()

    # RIGHT
    keyDown_39: ->
      return unless @owned
      return unless @canMoveTo(1, 0)
      @x++
      @moved()

