Start a new Scratch project - "File" and then "New"
Making the track involves drawing a track using the graphic editor built into Scratch.
Click on the "stage" and then "background" and then "edit" the white background.
Select the "paintbrush" tool...
... make the brush size quite large ...
... and choose brown for the colour of the track.
Draw a suitable track making it wide enough for the cars to go on but not too wide that the track is not a challenge. You are drawing a bird's eye view of a track. make sure that you have zoomed out as far as you can go otherwise you will have a very small track. As a guide the track should be "two brushes" wide.
Select the "fill" tool choose green and make the areas that are not track the grass infield. Press "OK" to save the track.
This is the track with a cat on it. The next step is to turn the cat into a car.1. Screenshot your project so far and describe how you made the track.
Click back on the cat and click on "costumes" then "edit" one of the cat's costumes.
Click on "Clear" to delete the cat costume.
The car is going to be quite small so "zoom in" so that you can draw it carefully. Use the chequerboard background to help you to get straight lines.
Using a series of rectangles and lines draw a racing car shape, something like this. This is a plan view of a car, a car seen from above so the wheels will be rectangles not circles. Make sure that the colour of the car is different from the colour of the black tyres. The circle in the centre is the driver's crash helmet.
Press "OK" to save your car.
This is my car on the track.
Even though I zoomed in to draw it, my car is still too big so resize it to be more suitable in terms of size.
This is much better; a suitably sized car on the track. Notice I have deleted the other cat costume from the car.
Rename the car sprite from "sprite1" to "car".8. Screenshot your project so far and describe how you made the car.
Click back on the car and then "scripts".
Add a script like this to make the car move.
The problem with this script is that the car goes off the edge of the screen and it cannot be steered.
Firstly the steering problem.
You should remember from the crab game how to add keyboard controls to the sprite. "When space pressed" is the code block to use like this. Select the "left arrow" ...
... add the motion block "turn 15" to make the car turn left.
Repeat this for turning right (using the right arrow).
You will find as I did that the car moves quite quickly and is not easy to control. Change the number of steps to be "2" as this seems good as a starting point.
This solves both problems as the car now stays on the screen.8. Screenshot your project so far and describe how you made the car move.
There needs to be a way to ensure that the car remains on the track so what happens when it goes on the grass?
Firstly we need to check that the car is on the track.
Add an "if" block inside the forever loop so that when the car touches the grass (green) then it returns to the start.
The "touching colour" block comes from "sensing" and then you select the colour part of the block the mouse pointer becomes a dropper, simply click somewhere in the colour you want the sprite to be touching.
Now when the car leaves the track it returns to the start. Now it is possible to play the game at a simple level.8. Screenshot your project so far and describe how you made the car stay on the track.
Rather than having the car return to the start, it will be better if the car is shown to crash, wait a while and then return to the start.
For this we will need some other costumes to show the car in flames.
Click on the car and then "costumes".
This is important, click on "copy" to make a copy of the car. This is to make sure that the original car is untouched.
I have added another burning car image so I can animate between the two so it appears that the car is burning. Adding more costumes and making the drawn changes betwen costumes more gradual will improve the quality of your game in the end.
Now it is time to change the script so that the car will crash and burn and not return to the start and set off again straight away.
Screenshot your project so far and describe ading flames to the car sprite.
Here is the new script.
Whrn the car leaves the track it changes to costumes 2 and 3 5 times and then reverts back to costume 1, goes to the start point and begins again.
This works well enough but how do I work out if I have won the race?8. Screenshot your project so far and describe how you made the car burst into flames when it crashes.
The first this we need to do is add the start / finish line to the track.
Go back to the stage, edit the track to include a white (important) start / finish line to your track. Save the change to the track.
Next, make a variable called "win" and change the script for the car as shown below. Every time the car hits the grass the variable "win" is set to zero.
This is the script to add to make the car count the laps and reset the number of laps if the car crashes.
It counts how many times the car crosses the white line; touching the colour white.
Try it and see if it works; it does.8. Screenshot your project so far and describe the car wins a one lap race.
A single lap is one thing but what has to change to make it a two lap race?
Make the changes shown in the roll_over image.
Now your car will race for two laps.
Screenshot your project so far and describe how you have added code to see if the car has driven round the track twice.8. Screenshot your project so far and describe how the car wins a two lap race.
The graphics so far are OK but they could be much better. Are there any better graphics that we could use. Firstly consider the track.
Go back to the stage and then click on "backgrounds" and click on "edit"...
... click on "clear" to remove the original image ...
... then click on "import" ...
... then choose "Computer" ...
(Student share is drive P:)
... navigate to / Department / Computing / _2017-2018 / KS3 / Year 8 / Cars ...
... and select a track. Press "OK"
Press "OK" again and you hav a more professionally drawn looking track.
With my amateur graphics there was a clear green edge for the car to bump into but in this track the edge is white. So the script needs to be changed. Touching green needs to be touching white.
Next I can't have white as the colour of the edge and the colour of the finishing line so I will change the colour of the finishing line to yellow.
Fianlly the car needs to be improved to match the track.
Click back on the car and select "costumes" then click on "edit" ...
... click on "clear" ...
... click on "import" ...
... using the same folder as before (computer - drive P: (student share)) then navigate to / Department / Computing / _2017-2018 / KS3 / Year 8 / Cars ... , select a car and press "OK" ...
... and finally press "OK" again.
Here is the car on the track.
Screenshot your project so far and describe changing the background and the car sprite to images stored on the student drive.
Its in the wrong place. Can you see what I have changed? I have added a set position block at the start to put the car int he right position and a point in direction" block to point the car the rigth way on the track. I have also changed the script where the car returns to the start after a crash.
Now I have added two more blocks to make the car have the right costume when it restarts and it appears to need a push to get started.
... and then change the script so that the the car crashes the way it is suposed to; the costume changes to crash1 and then crash2.
Project done.8. Screenshot your project so far and describe how you changed the graphics.
Add a second car and give the driver a chance to change the speed of their cars. Hint you will need to use a variable so look at the binary game to see how this is done.9. Screenshot your project so far and describe how you made the two player game.
When you add a second car and give the driver a chance to change the speed of their cars, you really should give the drive a chance to brake. Hint you will need to use a variable so look at the binary game to see how this is done.9. Screenshot your project so far and describe how you improved the two player game.