Scratch – Tutorial 04 – Create a Race Game in Ten Minutes

Scratch – Tutorial 04 – Create a Race Game in Ten Minutes


Okay, we’re back with another scratch tutorial this time. We’re going to learn how to create a race game in less than 10 minutes start by clicking create and You will be presented with a brand new project Make sure that you give this project an appropriate title in this case. We are going to use race game type Race game And you are ready to get started now. We do not need this pride, so go ahead and delete the sprite you [are] now left with your stage? for our race game we will have to create a backdrop so click on backdrop and The easiest way to create a backdrop is to use the fill with color tool This color will be important later on then select a brush For your actual track Again, you can use any color you like Just make sure [that] you use a very Wide brush as this will make things much easier We now have a track We will add a finish line so select a different color for your finish line and To make our game a bit more challenging. We are going to add some power-ups so choose any color for those Power-ups and You can scatter them [alright]. We now have our track ready the next step is to [create] our car so click on Paint new Sprite and make sure you’ve zoomed in in order to see the little cross in the Center This is the center of your sprite, and you will have to make sure that when you create [your] car It is created in the center of Your sprite Again, you can let your creativity go once you have your car zoom out and We can start our Programming so the first thing we will want to do is add a when the green flag is clicked We are going to switch our car back to its original Costume which will be our first costume [so] go to looks Switch costume to costume one we do not have a second costume yet, so let’s go ahead and create this right click duplicate and Turn your costume into a crashed car Feel free to add as many colors as [you] like Okay an important note on costumes is when you create your first costume make sure that you do not use the same color as your stage We are now working on our starting position. You can see the [x&Y] value down in the right hand corner These will be used for [our] starting position, so go to motion go to x equals y equals and These two values should be the same When the green flag [is] clicked our car will jump to the coordinates given in that X&Y block You can add your second block of code, so let’s say when the green flag is clicked. We are forever going to move a couple of steps now the more steps the faster your car will move so I’ve chosen to and You can see the car move Of course nothing happens when it touches the green because [I] have not yet programmed this That will be our next step A quick tip make sure that your code is nicely organized on your screen This in turn will make it much [easier] for you to read Now it’s time to program our controls so we are going to use the when key pressed and turn this into when the left arrow key is pressed and when the Right arrow key is pressed Now when the left arrow key is pressed. We wanted to turn left and when the right arrow key is pressed We want to turn right? So go ahead and select these motion blocks And as you can see my car can now turn Now it’s time for us to add a new block when the Green flag is clicked Switch to costume and point in [Direction] 90 degrees If we do not do this you will see that our car does not return to its original state We can also add our wait block which will make it easier [for] us to Prepare before playing the game Let’s go to the sensing we now want our car to switch to its second costume when it senses the color green so if then if our car senses the color then switch to costume, so if touching color Green go ahead and click on that color and select the color from your stage if touching color green then Switch costume to Costume 2 as You remember this is our crashed costume Let’s move this block inside our forever block So what we have now is a car that forever moves two steps, but when it touches green it switches to the second costume Now it does not stop yet, because we have not added the stop Script block which we can add at the end Switch to costume to stop this script let’s have a look at the result and it stops We now have a working race game, but we want to make it a bit more challenging So what we are going to add next are some power-ups and a reaction to the finish line So let’s go ahead and create a second if then block choose if the same way a sensing statement, so if touching the color red we are going to go a bit faster, so go to motion and give your car [an] extra couple of steps let’s go with four and Put this inside your forever statement What happens now is whenever we touch red our car speeds up? this adds a bit of challenge to your game and Makes it more fun The third if/then script we are going to add will be for our finish lines, so when we touch the black We want our car to win this game so if touch color black select black We will say you win, so I’ve got the looks say You win for two seconds? As with the previous [if-then] blocks we put this inside our forever this is important because forever Tells us that these three if-then blocks will forever run, so we click on play our Powerup Block works and Let’s Fast forward to the [end] If we touch the black it says you win We can also of course add a stop this script, or stop all I Hope you’ve enjoyed this tutorial you now have a working race game next time we’ll look at how we can use variables in order to add a score [to] our game Feel free [to] subscribe or come back for more videos

66 Replies to “Scratch – Tutorial 04 – Create a Race Game in Ten Minutes”

  1. When I first heard of Scratch I thought it was only for arduino. (For people who don't know what arduino is it is a physical module or a electronic.) Also thanks for helping I didn't have that much knowledge on how to do this. I have also heard of another good website but was boring which is www.code.org use scratch its better and has a very wide range of what you can do. www.code.org was very small. This is my game… https://scratch.mit.edu/projects/84731956/#player

  2. Awesome! I just started and i finished! i tried it and it was so good!! Al because of u i got 2 do this right and not mess up :D! (Also Its My 1st Time Using Scratch ;3) This Video Helped A Lot For Me To Understand The Codes In Scratch! My 1st Game I've Ever Made!! SO HAPPY 😀

  3. thanks for the game my first game i made without accidently presseding delete lol thx i get it now but can u make a vid for this to make power ups also somtimes hurt you? like maybe super fast or crashing auto

  4. hey! you can cheat by going backwards so make another WHITE line behind the back the accual finish and instead of sensing black to win u sense the white (plus black and white is finish line coLOUR xd)

  5. my car won't turn, i have tried at least 4 variations of this code but it still doesn't move right. can anyone help me?

  6. Ins't it easier to do a program like:
    START
    Forever
    –If Left Press
    —Turn Left
    –If Right Press
    –Turn Right

    And so on?

    If you use thoses blockes 'If Button pressed', you have to use the loop 'Forever Until Button Unpressed'.
    If not, we have to wait until the car turn for a long time.

    6:57 You can combine the two first program. The first goes before the second program, it's like you decompose them.

    This game sound challenging as we should avoid touching the green area.

    Speaking of which,what hapenned if the car turn back and hit the black line? Does it considerate as cheating? Or look impossible due of the angle of turning?

  7. Can you help me….how can I address the participant by name, e.g., "Hi Fred, welcome to the quizz" at the end of the quizz (as well as the begining) i.e., "Fred you finished your first quizz"….https://scratch.mit.edu/projects/155861175/#player

  8. Thank you SO much – I would've been no help at all to my son with an important school project, if I didn't have this video to refer to. +1 more subscriber and likes all over the place for any vids of yours that I see. You literally, saved my butt! Thank you!! 👍🏼🙏🏼🙏🏼👍🏼

  9. Thank you so much! This was very very useful! I can now show off to my class and tell them I used a tutorial on a website nobody uses (in my class) YouTube! I've subscribed and I am hoping a lot more from you in the future! 🙂 have a great day! :3

  10. To do laps in scratch: Create a variable and name it what you want example: Laps. Then Pit under when Touching black and put a If Laps = 3 then say you win for Any seconds. End of Tape.

Leave a Reply

Your email address will not be published. Required fields are marked *