Presentation is loading. Please wait.

Presentation is loading. Please wait.

In this tutorial, we are going to create: A race car that the user can control with the arrow keys for direction and speed. A simulated road with a striped.

Similar presentations


Presentation on theme: "In this tutorial, we are going to create: A race car that the user can control with the arrow keys for direction and speed. A simulated road with a striped."— Presentation transcript:

1

2 In this tutorial, we are going to create: A race car that the user can control with the arrow keys for direction and speed. A simulated road with a striped line down the center showing "speed" and "motion" of car. Obstacles for the car to avoid

3 To begin with, we are going to create the stage for our race car game. Select the Stage, click the Backgrounds tab, then click the Edit button.

4 Draw a racetrack background similar to the image as shown to the right.

5 Now that we have our stage, we can begin to create our race car. Click the Paint new sprite button and draw a racecar from the perspective of looking down at the car from above, similar to the image to the right.

6 Our race car will be controlled using the Up Arrow, Down Arrow, Left Arrow, and Right Arrow keys. Thus, we need to create scripts for each key. To begin with, create the Up Arrow script as shown in the image to the right. This simply moves the car up by 10 when the up arrow is pressed.

7 Next, create the Down Arrow script as shown in the image to the right. This script moves the car down by 10 when the down arrow is pressed.

8 To simulate a real car, we are going to make the sprite rotate slightly whenever the user presses the left or right arrow keys Create the Right Arrow script as shown in the image to the right.

9 Lastly, create the Left Arrow script as shown in the image to the right.

10 Test all of your arrow keys to ensure your race car is working as intended.

11 Next we are going to keep track of the racecars speed. variable Speed Create a new variable (for all sprites) called Speed.

12 Create the script as shown in the image to the right to keep track of the racecars speed.

13 The next step in this tutorial is to simulate movement and speed. To do this, click the Paint new sprite button and draw a sprite similar to the image in the right.

14 We want our striped line to continually move downwards. To do this, create the script as shown in the image to the right.

15 Next, we want the line to appear at the top of the screen once it reaches the bottom of the screen. To do this, create the script as shown in the image to the right. You may need to adjust how long to wait depending on how you drew your line sprite.

16 The final step in this tutorial is to create obstacles for our racecar to avoid. Create a new sprite and draw an obstacle. In this tutorial, we will use a puddle of oil as an example.

17 We want the obstacle to repeatedly and randomly appear on the screen. To accomplish this, create the script as shown to the right.

18 Lastly, we want our racecar to spin out of control if it touches the oil. To do this, click your Car sprite and create the script as shown to the right.

19 Congratulations! Youve finished your racecar game. Dont forget to test your game to ensure everything works properly. See the next slide for additional challenges to complete.

20 Add sounds to your game Add a score variable that increases by 1 every 3 seconds, but decreases by 5 whenever the car hits the oil, and/or whenever the car leaves the road and drives on the grass. Add more obstacles Be creative!


Download ppt "In this tutorial, we are going to create: A race car that the user can control with the arrow keys for direction and speed. A simulated road with a striped."

Similar presentations


Ads by Google