240 likes | 349 Views
Marble Racer. The screen where you can see what happens when you play your game is called the STAGE . The SCRIPT BANK is where the types of instructions are stored. The SCRIPT BLOCKS are where the instructions of what your SPRITES can do !.
E N D
The screen where you can see what happens when you play your game is called the STAGE. The SCRIPT BANK is where the types of instructions are stored. The SCRIPT BLOCKS are where the instructions of what your SPRITES can do! SCRIPTS AREA is where you put your instructions The SPRITES are where you store and select the STAGE and COSTUMES
What is a Sprite? • A Sprite is a character that plays in the game • Students can change their sprite, either by drawing a new one • Or choosing one from a file
Design a racetrack and car • You need to design a simple racetrack and race car as viewed from above. • You will need to keep your design simple so that you can draw it using the paint editor • You will need to use clear colours as these will be used to detect the position of the car.
What will we learn? • Move a sprite using the keyboard. • Add to players to the game • Use the stop script to stop a game • Use the say block to announce a winner • Add a timer to show the winning time
Create a new background with the editor • Click on the stage and use the editor to draw a racetrack
Use the up arrow key to move the car • Use the forever control block and the if control with the key pressed sensor to detect a key pressed and move the car.
Use the up arrow key to move the car • Use the forever control block and the if control with the key pressed sensor to detect a key pressed and move the car.
Use the other arrow keys to move the car • Test the program to make sure you can move the car in all directions. Change the move steps amount to slow down or speed up the car.
Use the other arrow keys to move the car • Test the program to make sure you can move the car in all directions. Change the move steps amount to slow down or speed up the car.
Add a second car • Use the a, s, w, z, keys to control the second car so you can have a two player game
Test your game • Get into pairs and play each others games to make sure that both cars move correctly in all directions.
Be a winner! • Create a finish line sprite so that when a car touches the finish line they win!
Key Point – Stop Script • Stop script • Use the stop script so that once a car has won the race another car cannot win. Try the game without the stop script.
What else do we need? • Add a timer to see how fast the winning car goes. • Stop the game if a car goes on the grass OR keep a score of the number of times the car goes on the grass • Reset the game once a car has won
Add a timer • Tick the timer on the sensing block to create a timer
Add a timer • Tick the timer on the sensing block to create a timer
Announce the winning time • Use the say block from the Looks controls and the reset timer from the sensing controls to announce the winning time
Announce the winning time • Use the say block from the Looks controls and the reset timer from the sensing controls to announce the winning time
Stop the car if it goes on the grass • Use the if control with the touching colour sensor to detect the car on the grass. Reset the car position when green flag clicked.
What now? • Get into pairs and play your games and see what improvements you can make. • Discuss your games with each other as you test them. • You made to need alter the size and orientation of the cars to get them both to fit on the start line. • You may want to change the value of move to slow the game down if you are crashing all the time.
Extension tasks • Create a timer for each car using variables • Make the car explode when it goes on the grass (hint: switch costumes) • How can you stop a car going backward around the course and crossing the finish line in the wrong direction? • Change the stage at the end of the race to show a new racetrack and start a new game