Download presentation
Presentation is loading. Please wait.
1
Exploring Computer Science – Lesson 4-5
Event Driven Programs Exploring Computer Science – Lesson 4-5
2
Objectives The students will be able to:
Make a sprite change costumes. Make a sprite speak…in text and/or sound. Initiate programming action with user input.
3
Discussion How do programs know what to do next? In other words…
If you are surfing the web, how does the computer know what page to go to next? Or… if you are playing Call of Duty: Ghosts, how does the game know what you want to do?
4
Event Driven Programs The programs you have written so far have really just been animations. You click the and then sit back and watch what happens. In all these cases, the program controls the action. In an event driven program, the user controls the actions by typing a key, clicking the mouse, etc. The outcome of the program is not known in advance.
5
Scratch Event Blocks Scratch event blocks are found in the control section and have a shape like this: You have already used one event block! And SOME of you have used some others!!!
6
Scratch Event Blocks There are 2 more event blocks:
When a sprite is clicked When _ key is pressed
7
Your First Game You will be creating an Alphabet Learning Game.
8
Alphabet Game Requirements
Have at least 10 different letters. Have a theme for your letter game (i.e. animals, food, etc.). Sprites change costume when clicked on. Sprites change costume when letter is typed on keyboard. Use the “say _ for _ sec” to output what the letter stands for (i.e. “E is for Elephant”). Sprites all turn to letters when the “when green flag clicked” is clicked.
9
Alphabet Game – Extra Credit
For extra credit… Use a sound file or a microphone to record sounds for all the letters and play the sound when the letter is clicked or typed (i.e. “E is for Elephant” and the sound of an elephant)
10
Rubric Do you… Points Possible What Do You Think?
Have at least 10 different letters? 20 Have a theme for your alphabet game (i.e., animals, cars, food, games, etc.)? 5 Have each sprite change costume when clicked on? Have each sprite change costume when the associated keyboard letter is typed? Use the “say ( ) for ( ) sec” block to output what the letter stands for (i.e., “L is for leopard”)? Have all sprites reinitialized to letters when the green flag is clicked? 10 Have correct grammar, punctuation, capitalization and spelling? Extra Credit Use a sound for all letters in addition to text and play the sound when the letter is clicked or typed? TOTAL: 100
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.