Простой вход для игр JavaScript

document.body.addEventListener("keydown", function (e) {
  switch (e.key) {
    case ' ':
      flappyBird.velocity.y = -jumpPower
      break
    case 'Enter':
      if(!gameStarted){
        gameStarted = true
        render()
      }
      break
    default:
      break
  }
})
Himanshu Jangid