     @handleAdminControls()
 
     p1in = @p1Controller.update()
-    console.log p1in if p1in
+    # console.log p1in if p1in
     @input.controllers.player1 = p1in
     # @input.controllers.player2 = @p2Controller.update()
 

        when 'fall'
          velocity.y = 0

      samus.action = null

      # TODO: Gravity system?
      # TODO: always apply? or just when airborn?
      # velocity.y += 100/1000 * dt
      max = 200/1000
      velocity.y += max/10
      velocity.y = max if velocity.y > max
      # console.log "v #{velocity.x} #{velocity.y}"
    

Systems.register 'velocity_position', class GestureAction
  run: (estore,dt,input) ->
    for velocity in estore.getComponentsOfType('velocity')
      if position = estore.getComponent(velocity.eid, 'position')
        dx = velocity.x * dt
        dy = velocity.y * dt

        newX = position.x + dx
        newY = position.y + dy

        # Detect map collisions
        tileRow = Math.floor(newY/16)
        tileCol = Math.floor(newX/16)
        row = roomData[tileRow]
        block = null
        if row?
          block = row[tileCol]
          if block?
            if velocity.y > 0
              newY = (tileRow * 16)
              velocity.y = 0

        if newY > 240
          newY = 240
          velocity.y = 0

        position.x = newX
        position.y = newY

  [ null,null,null,null, null,null,null,null, null,null,null,null, null,null,null,null ]
  [ null,null,null,null, null,null,null,null, null,null,null,null, null,null,null,null ]
]

tileSearchVertical = (grid, x, topY, bottomY) ->
  hits = []
  c = Math.floor(x/16)
  for r in [Math.floor(topY/16)..Math.floor(bottomY/16)]
    row = grid[r]
    if row?
      hit = grid[r][c]
      if hit?
        hits.push [r,c,hit]
    # else
    #   console.log "vsearch NO row? #{r}",grid
  hits

tileSearchHorizontal = (grid, y, leftX, rightX) ->
  hits = []
  r = Math.floor(y/16)
  row = grid[r]
  if row?
    for c in [Math.floor(leftX/16)..Math.floor(rightX/16)]
      hit = grid[r][c]
      if hit?
        # hits.push hit
        hits.push [r,c,hit]
  hits
