Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

62
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!