Presentation is loading. Please wait.

Presentation is loading. Please wait.

Game Over Module 4 Lesson 2.

Similar presentations


Presentation on theme: "Game Over Module 4 Lesson 2."— Presentation transcript:

1 Game Over Module 4 Lesson 2

2 Learning Objectives To be able to use variables and lists
To be able to use broadcast messages to trigger events in Scratch. To understand the importance of initializing everything at the start of a game.

3 Today We will continue to develop the game previously started.
We will use variables to keep count of the number of lives remaining for a character A special feature called broadcast will be used to trigger all events that need to run when the game ends Then look for potential problems and solutions. We will use a list to store numbers as well as strings of letters and other characters.

4 Open your Game from the Last Session
If you do not have a copy of your first game, open M4L1R2_Game_Version_1 from the assignments folder. We are going to create a variable that changes during the game. This variable tracks the number of lives remaining for the Good Guy.

5 Creating a Variable 2. Select the Variables block 1) Select Scripts
3. Click on ‘Make a Variable.’ Enter a name that describes what it is storing. Lives for this example. Click ‘OK’

6 Modifications We will need to set the lives to 5 at the start of the game. Then find the piece of code that occurs when the Good Guy runs into the Bad Guy and decrease the number of lives by 1.

7 When the Green Flag is hit, the lives are set to 5.
Possible Solution When the Green Flag is hit, the lives are set to 5. Every time the Good Guy runs into the Bad Guy, the number of lives decreases by 1. Test it!!

8 Game Over When the lives go down to 0 the game ends.
This will need to be checked all the time (forever loop) If lives = 0 we will broadcast Game Over When each of the sprites receive a ‘Game Over’ broadcast A new background is shown for the end of the game

9 Broadcasting Game Over
Broadcast -> New then enter Game Over

10 Put this in each of the sprites.
Game Over What should happen when the game ends? Sprites need to go away (Hide) A Message should appear on the Screen (Game Over) A new Background should appear for the end of the game. Test it.. What happens? Put this in each of the sprites. Have the Background change. In the End Of Game background, include the words Game Over

11 Need to Reset the Values
For the Sprites, include a show in the When Green Flag Clicked. For the Background, add a When Green Flag Clicked, return to the Game Background.

12 Using a List to make Random Comments
We will create a list of 4 things the Good Guy will say when he hits the Bad Guy.

13 List 1 Variables Make a List
Give it a name that describes what is being stored. “Things to Say” for this example.

14 Adding to the List Click on the ‘+’ to increase the size of the list. Then enter a new phrase for the list.

15 Change the drop down choice to ‘any’
Saying from the List Change the drop down choice to ‘any’

16 Uncheck the Things to Say box.
Hide the List Monitor Uncheck the Things to Say box.

17 Finishing it up Complete the parts we have done as a class Extensions
Develop a scoring system for the game and a way of winning or losing at the end of the game. Introduce levels of the game. The speed and movement of the bad guy could increase as the levels progress. Use Lists to add a list of things the Bad Guy says if contacting the Good Guy. Save it as YourNameMod4Lesson2 and turn it in


Download ppt "Game Over Module 4 Lesson 2."

Similar presentations


Ads by Google