Looking for a specific tutorial, does anyone have any recommendations?

Hi guys,

I am looking for a specific turtle race type of javascript tutorial to learn, similar to the one below. The issue with the one below is that it is python programming and I don’t feel ready to get my feet wet with another language at the moment. Any help would be much appreciated!

python turtle race game

Hello @ayanda

if you looking for game programing then check this

https://developer.mozilla.org/en-US/docs/Games

but it would be better to finish the js tutorial first

hope that help and have a nice day :slight_smile:

Hey, I am looking for a specific tutorial that goes over building a javascript turtle race game like in the link from the original post.

@ayanda sorry i do not know

No problem, I decided to use what I know to try and build one anyway… however, I have encountered a problem.

While editing my code somehow I made a mistake that makes the 3 colors start at position 100 on the x axis as opposed to the position 10. If you can assist me in how to make it so when the user presses the watch race button, the colors start their race from 10 and change their pace when they reach a certain position on the x axis. The link is below.

Racing game

sure i would like to do that

but in this post you said you managed to solve something

is it about the same thing or something else

and well done if you did it and have a nice day :slight_smile:

Hi, that was a different issue. The one I replied you with is my current issue:
the 3 colors start at position 100 on the x axis as opposed to the position 10.
They are supposed to start racing and change speeds from certain marks like 100 on the x-axis, etc… but instead as you will notice, they end up starting from position 100 instead of 10

Racing game

Hello @ayanda

not sure if i got you
but if you change those

runnerRed = new component(20, 20, "red", 0, 50);         i set x to 0
    runnerBlue= new component(20, 20, "blue", 0, 120);
    runnerGreen= new component(20, 20, "Green", 0, 200);
    ``` 

it will make the component start from x = 0 not x = 10 

is that what you want or i miss understand something

I want the components to start from x=10… however, I want their speeds to vary as they race and when I implemented the if stat… oh… I just figured it out oh my god… I got it! == instead of =… because… yeah… I got it… sorry for wasting your time… I been on this code for a while an I guess I needed to think out loud to anyone who would listen to figure it out… in my own head I couldn’t find the solution.


var speed= [2.7, 2.9,3, 2.1, 2.3 ,2.4 , 2.6,2, 2.2 , 2.5 , 2.8]
function runnersSpeed(){
    
    var speedRan= speed[Math.floor(Math.random()*speed.length)];
   
    return speedRan;
    
}


function race(){



runnerBlue.speedX +=runnersSpeed();
console.log("Blues first speed"+runnerBlue.speedX);

runnerGreen.speedX +=runnersSpeed();
console.log("Greens  first speed"+runnerGreen.speedX);

runnerRed.speedX +=runnersSpeed();
console.log("Reds first speed"+runnerRed.speedX);

if(runnerBlue.x=100){
  runnerBlue.speedX=0;
  runnerBlue.speedX+=runnersSpeed();
  console.log("Blue's second speed"+runnerBlue.speedX);
}

if(runnerRed.x=100){
  runnerRed.speedX=0;
  runnerRed.speedX+=runnersSpeed();
  console.log("Reds second speed"+runnerRed.speedX);
}


if(runnerGreen.x=100){
  runnerGreen.speedX=0;
  runnerGreen.speedX+=runnersSpeed();
  console.log("Green second speed"+runnerGreen.speedX);
}

  }

congratulations and well done :slight_smile: