//-------------------------------------------------------------------------
// 3.1 INPUT
//-------------------------------------------------------------------------

function onkey(ev, key, down) {
  switch (key) {
    case KEY.LEFT:
      player.left = down
      shouldPanCameraToTheRight({ canvas, cameraWithBox })
      ev.preventDefault()
      return false
    case KEY.RIGHT:
      player.right = down
      shouldPanCameraToTheLeft({ canvas, cameraWithBox })
      ev.preventDefault()
      return false
    case KEY.X:
      player.jump = down
      shouldPanCameraDown({ canvas, cameraWithBox })
      ev.preventDefault()
      return false
    case KEY.Y:
      //  player.shooting = down
      shoot(player)
      ev.preventDefault()
      return false
    case KEY.UP:
      player.up = down
      shouldPanCameraDown({ canvas, cameraWithBox })
      ev.preventDefault()
      return false
    case KEY.DOWN:
      player.down = down
      ev.preventDefault()
      return false
    case KEY.ENTER:
      player.interact = down
      ev.preventDefault()
      return false
    case KEY.SPACE:
      ev.preventDefault()
      return false
  }
}
