SlideShare a Scribd company logo
1 of 15
Download to read offline
Making a Racing Game
in Scratch
By Douglas Mawrey
Getting Started
Log in to Scratch, then go into your projects and
create a new project. Name it something along the
lines of “Racing Game” so you and other people know
what it is.
Making a Racetrack
Click the “Paint new backdrop” button in the bottom left of the screen to open a
window where you can draw a racetrack. While drawing, make sure you are
always in “Vector Mode”, otherwise, click “Convert to Vector” Keep one main
color as the color of the racetrack, we will use this color to check what the car is
touching later on.
Making a Car
Next, right click on the cat and click delete. Click on the “Paint new sprite”
button and draw a racecar. Make sure the car isn’t too small to see well or
too big to fit on the track and make it face right. Once you are done drawing,
click the “Set costume center” button at the top right of the screen and make
sure the black + lines up with the center of your sprite.
Making the Car Move
To make the car move, we need to drag some blocks to
make some code. In the scripts tab of your car, use the
blocks on the left of the screen to make this piece of code.
Each colored piece can be found in the different colored
sections on the left. To change “key ‘space’ pressed?” to
up arrow, click on the black arrow next to the name of the
key to choose the key you want.
Making the Car Move
Right click on the top of the group of code and click
duplicate. Then, attach the new group of code to the
bottom of the first group. Change “up arrow” to “down
arrow” and turn right to turn left.
Making the Car Move
To finally let the car move, make a new piece of code with a start block and a
forever loop. Next, drag the code you put together before into the forever loop.
Now, hit play and use the arrow keys to drive the car.
+ =
Variables
Variables store information that we can use throughout the
game. For this game, we are going to use a variable
named speed to change the speed of the car.
Using Speed
We want the car to slow down when it is driving off-road. To do this, we are
going to make a new script that sets the normal speed when the game starts.
The script then checks if the car is touching the road using if/else and a color
sensor, and if it is not, changes the speed to the lower number. We also need
to add speed into the movement code where 10 and -10 used to be, and
multiply speed by -1 to make the car move backwards for down
arrow.
Laps
Draw a new sprite that can serve as a start line for your race. Make it just wide
enough to cover the track left to right. Duplicate the sprite, and put the copy on
the other side of the track. If you like, you can make the start line look different
from the midpoint line by coloring it differently.
Laps
To make the laps work, we need to add 3 pieces of code to the two different lap
parts. We need a new variable and to use broadcasts which send messages to
the other sprites.
Starting the Game
Drag the player just behind - but not touching the start line.
After this, if you drag in the block, it will have
the x and y of the car filled in automatically. We put this
extra piece of code on the player in order to make it start at
the start line at the beginning of each game.
Timed Games
To add a timed option to the race, add this code to the stage. This code asks
the amount of time you want to race for, and if you enter “forever” or “Forever”,
it doesn’t time you. The driving script on the car must also be changed,
replacing the When Green Flag Clicked with When I Receive “Start”.
Boosts
In order to add a boost
power up, a new sprite must
first be drawn. These two
scripts will then need to be
added to the new sprite in
order to make the boost
spawn, stay for 3 seconds,
and disappear. The Boost
variable must also be made.
Boosts
Some code on the player must also be changed in order to make the boost
work. The code on the left must be changed to look like the code on the right
allowing the player to activate the boost by pressing space.

More Related Content

What's hot

Mac OS Seminar report
Mac OS Seminar reportMac OS Seminar report
Mac OS Seminar report
Karthik Kumar
 
Windows 7 interface
Windows 7 interfaceWindows 7 interface
Windows 7 interface
SirajRock
 
Generation of computer languages
Generation of computer languagesGeneration of computer languages
Generation of computer languages
kitturashmikittu
 

What's hot (20)

Scratch Programming
Scratch ProgrammingScratch Programming
Scratch Programming
 
Scratch Basics
Scratch BasicsScratch Basics
Scratch Basics
 
Coding Basics with Scratch
Coding Basics with ScratchCoding Basics with Scratch
Coding Basics with Scratch
 
Scratch
ScratchScratch
Scratch
 
Computer keyboard
Computer keyboardComputer keyboard
Computer keyboard
 
Control panel 07
Control panel 07Control panel 07
Control panel 07
 
Mac OS Seminar report
Mac OS Seminar reportMac OS Seminar report
Mac OS Seminar report
 
Windows 7 interface
Windows 7 interfaceWindows 7 interface
Windows 7 interface
 
Generation of computer languages
Generation of computer languagesGeneration of computer languages
Generation of computer languages
 
Scratch Lesson 3
Scratch Lesson 3Scratch Lesson 3
Scratch Lesson 3
 
Microsoft Excel 2007: Create Your First Workbook
Microsoft Excel 2007: Create Your First WorkbookMicrosoft Excel 2007: Create Your First Workbook
Microsoft Excel 2007: Create Your First Workbook
 
Scratch for intermediates course
Scratch for intermediates courseScratch for intermediates course
Scratch for intermediates course
 
Intro To Scratch
Intro To ScratchIntro To Scratch
Intro To Scratch
 
Scratch Lesson 2
Scratch Lesson 2Scratch Lesson 2
Scratch Lesson 2
 
Snake game implementation in c
Snake game implementation in cSnake game implementation in c
Snake game implementation in c
 
Kids coding
Kids codingKids coding
Kids coding
 
Scratch Project
Scratch ProjectScratch Project
Scratch Project
 
Ms excel
Ms excelMs excel
Ms excel
 
Wordpad
WordpadWordpad
Wordpad
 
Scratch programming introduction to game creation
Scratch programming  introduction to game creationScratch programming  introduction to game creation
Scratch programming introduction to game creation
 

Similar to Scratch Programming Racing Game Tutorial

Calculator 1
Calculator 1Calculator 1
Calculator 1
livecode
 
Alice startparttwo
Alice startparttwoAlice startparttwo
Alice startparttwo
sumidahilo
 
How to create_your_own_android_app
How to create_your_own_android_appHow to create_your_own_android_app
How to create_your_own_android_app
Charo Cuart
 
How to create a film poster
How to create a film posterHow to create a film poster
How to create a film poster
HG17
 
SAP2000 Cold-formed steel truss.pdf
SAP2000 Cold-formed steel truss.pdfSAP2000 Cold-formed steel truss.pdf
SAP2000 Cold-formed steel truss.pdf
stnOnurBaktr
 

Similar to Scratch Programming Racing Game Tutorial (20)

04 Car race track game
04   Car race track game04   Car race track game
04 Car race track game
 
Modul 1 Scratch
Modul 1 ScratchModul 1 Scratch
Modul 1 Scratch
 
Calculator 1
Calculator 1Calculator 1
Calculator 1
 
How to use photoshop
How to use photoshopHow to use photoshop
How to use photoshop
 
Introduction of vissim software - SlideShare Ptv vissim student version_basi...
 Introduction of vissim software - SlideShare Ptv vissim student version_basi... Introduction of vissim software - SlideShare Ptv vissim student version_basi...
Introduction of vissim software - SlideShare Ptv vissim student version_basi...
 
Alice startparttwo
Alice startparttwoAlice startparttwo
Alice startparttwo
 
Alice Start Part Two
Alice Start Part TwoAlice Start Part Two
Alice Start Part Two
 
How to create_your_own_android_app
How to create_your_own_android_appHow to create_your_own_android_app
How to create_your_own_android_app
 
Creative styling for your car
Creative styling for your carCreative styling for your car
Creative styling for your car
 
Creating treasure hunt with Actionbound
Creating treasure hunt with ActionboundCreating treasure hunt with Actionbound
Creating treasure hunt with Actionbound
 
7.Advanced Scripts in Scratch.pptx
7.Advanced Scripts in Scratch.pptx7.Advanced Scripts in Scratch.pptx
7.Advanced Scripts in Scratch.pptx
 
How to start a simple animation.
How to start a simple animation.How to start a simple animation.
How to start a simple animation.
 
Algorithm
AlgorithmAlgorithm
Algorithm
 
How to create a film poster
How to create a film posterHow to create a film poster
How to create a film poster
 
Unit 5 Task 4 Tutorial
Unit 5 Task 4 TutorialUnit 5 Task 4 Tutorial
Unit 5 Task 4 Tutorial
 
Unit 5 Task 4 Create an Ad
Unit 5 Task 4 Create an AdUnit 5 Task 4 Create an Ad
Unit 5 Task 4 Create an Ad
 
How to make gold in photoshop
How to make gold in photoshopHow to make gold in photoshop
How to make gold in photoshop
 
SAP2000 Cold-formed steel truss.pdf
SAP2000 Cold-formed steel truss.pdfSAP2000 Cold-formed steel truss.pdf
SAP2000 Cold-formed steel truss.pdf
 
Graphics
GraphicsGraphics
Graphics
 
Vector Look & Feel in Photoshop Using Clipping Path
Vector Look & Feel in Photoshop Using Clipping PathVector Look & Feel in Photoshop Using Clipping Path
Vector Look & Feel in Photoshop Using Clipping Path
 

Recently uploaded

Recently uploaded (20)

Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?
 
Auto Affiliate AI Earns First Commission in 3 Hours..pdf
Auto Affiliate  AI Earns First Commission in 3 Hours..pdfAuto Affiliate  AI Earns First Commission in 3 Hours..pdf
Auto Affiliate AI Earns First Commission in 3 Hours..pdf
 
Encryption Recap: A Refresher on Key Concepts
Encryption Recap: A Refresher on Key ConceptsEncryption Recap: A Refresher on Key Concepts
Encryption Recap: A Refresher on Key Concepts
 
OpenChain Webinar: AboutCode and Beyond - End-to-End SCA
OpenChain Webinar: AboutCode and Beyond - End-to-End SCAOpenChain Webinar: AboutCode and Beyond - End-to-End SCA
OpenChain Webinar: AboutCode and Beyond - End-to-End SCA
 
Navigation in flutter – how to add stack, tab, and drawer navigators to your ...
Navigation in flutter – how to add stack, tab, and drawer navigators to your ...Navigation in flutter – how to add stack, tab, and drawer navigators to your ...
Navigation in flutter – how to add stack, tab, and drawer navigators to your ...
 
[GRCPP] Introduction to concepts (C++20)
[GRCPP] Introduction to concepts (C++20)[GRCPP] Introduction to concepts (C++20)
[GRCPP] Introduction to concepts (C++20)
 
Lessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdfLessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdf
 
Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024
 
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
 
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
 
Rapidoform for Modern Form Building and Insights
Rapidoform for Modern Form Building and InsightsRapidoform for Modern Form Building and Insights
Rapidoform for Modern Form Building and Insights
 
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfAzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
 
Abortion Clinic In Stanger ](+27832195400*)[ 🏥 Safe Abortion Pills In Stanger...
Abortion Clinic In Stanger ](+27832195400*)[ 🏥 Safe Abortion Pills In Stanger...Abortion Clinic In Stanger ](+27832195400*)[ 🏥 Safe Abortion Pills In Stanger...
Abortion Clinic In Stanger ](+27832195400*)[ 🏥 Safe Abortion Pills In Stanger...
 
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
 
Abortion Pill Prices Jozini ](+27832195400*)[ 🏥 Women's Abortion Clinic in Jo...
Abortion Pill Prices Jozini ](+27832195400*)[ 🏥 Women's Abortion Clinic in Jo...Abortion Pill Prices Jozini ](+27832195400*)[ 🏥 Women's Abortion Clinic in Jo...
Abortion Pill Prices Jozini ](+27832195400*)[ 🏥 Women's Abortion Clinic in Jo...
 
Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...
 
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale IbridaUNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
 
Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...
Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...
Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...
 
Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...
Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...
Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...
 
Weeding your micro service landscape.pdf
Weeding your micro service landscape.pdfWeeding your micro service landscape.pdf
Weeding your micro service landscape.pdf
 

Scratch Programming Racing Game Tutorial

  • 1. Making a Racing Game in Scratch By Douglas Mawrey
  • 2. Getting Started Log in to Scratch, then go into your projects and create a new project. Name it something along the lines of “Racing Game” so you and other people know what it is.
  • 3. Making a Racetrack Click the “Paint new backdrop” button in the bottom left of the screen to open a window where you can draw a racetrack. While drawing, make sure you are always in “Vector Mode”, otherwise, click “Convert to Vector” Keep one main color as the color of the racetrack, we will use this color to check what the car is touching later on.
  • 4. Making a Car Next, right click on the cat and click delete. Click on the “Paint new sprite” button and draw a racecar. Make sure the car isn’t too small to see well or too big to fit on the track and make it face right. Once you are done drawing, click the “Set costume center” button at the top right of the screen and make sure the black + lines up with the center of your sprite.
  • 5. Making the Car Move To make the car move, we need to drag some blocks to make some code. In the scripts tab of your car, use the blocks on the left of the screen to make this piece of code. Each colored piece can be found in the different colored sections on the left. To change “key ‘space’ pressed?” to up arrow, click on the black arrow next to the name of the key to choose the key you want.
  • 6. Making the Car Move Right click on the top of the group of code and click duplicate. Then, attach the new group of code to the bottom of the first group. Change “up arrow” to “down arrow” and turn right to turn left.
  • 7. Making the Car Move To finally let the car move, make a new piece of code with a start block and a forever loop. Next, drag the code you put together before into the forever loop. Now, hit play and use the arrow keys to drive the car. + =
  • 8. Variables Variables store information that we can use throughout the game. For this game, we are going to use a variable named speed to change the speed of the car.
  • 9. Using Speed We want the car to slow down when it is driving off-road. To do this, we are going to make a new script that sets the normal speed when the game starts. The script then checks if the car is touching the road using if/else and a color sensor, and if it is not, changes the speed to the lower number. We also need to add speed into the movement code where 10 and -10 used to be, and multiply speed by -1 to make the car move backwards for down arrow.
  • 10. Laps Draw a new sprite that can serve as a start line for your race. Make it just wide enough to cover the track left to right. Duplicate the sprite, and put the copy on the other side of the track. If you like, you can make the start line look different from the midpoint line by coloring it differently.
  • 11. Laps To make the laps work, we need to add 3 pieces of code to the two different lap parts. We need a new variable and to use broadcasts which send messages to the other sprites.
  • 12. Starting the Game Drag the player just behind - but not touching the start line. After this, if you drag in the block, it will have the x and y of the car filled in automatically. We put this extra piece of code on the player in order to make it start at the start line at the beginning of each game.
  • 13. Timed Games To add a timed option to the race, add this code to the stage. This code asks the amount of time you want to race for, and if you enter “forever” or “Forever”, it doesn’t time you. The driving script on the car must also be changed, replacing the When Green Flag Clicked with When I Receive “Start”.
  • 14. Boosts In order to add a boost power up, a new sprite must first be drawn. These two scripts will then need to be added to the new sprite in order to make the boost spawn, stay for 3 seconds, and disappear. The Boost variable must also be made.
  • 15. Boosts Some code on the player must also be changed in order to make the boost work. The code on the left must be changed to look like the code on the right allowing the player to activate the boost by pressing space.