Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

63
Visualizações
Object inside canvas move faster whenever i press button

So i have something similar to snake game ( with just head) but when ever i press button call function change direction ( left, right ....) it keep going faster.I think it because setimeout but i dont know where to put cleartimeout can you guy help me ?

function automove() {    
     Snake[1] = snake[1] + y;
     Snake[0] = snake[0] + x;
    }
  function left() {
    x = -5; 
    y = 0;
    if( i = 1) {
        start();
     }};
  function start() {
       gamerun = true;
       drawotobody();
       nextmove();
     };
  function nextmove() {
      if(gamerun = true){
        setTimeout(()=>{
        contactborder();
        clearboard();
        drawotobody();
        automove();
        nextmove();
       }, 75);}
     };
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda