Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

172
Vistas
KeyIsDown does not seem to work with the right arrow

I'm writing a simple 2D platformer game on p5js, with Visual Studio Code 2022. I want to move this dinosaur sprite to the right and the left, however the keyIsDown for the right arrow doesn't work. I get no error message, and the game is always functional, and the key on the keyboard is working, but the sprite doesn't move to the right. Any ideas on how to solve this?

the code I wrote: code image

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Two answers:

  1. You could use the function keyIsPressed(LEFT_ARROW)

  2. You could have a separate function keyIsDown() outside of the draw function.

function keyIsDown(){

  if(key == LEFT_ARROW){

    doTheDinoStuff();
    
  }
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda