scratch programming session 9 of 10 review elements to use in stories, games, etc
Post on 19-Dec-2015
222 views
TRANSCRIPT
Objectives
• REVIEW, ANSWER QUESTIONS, GET FEEDBACK• We will be going around again today to check
if you are having any problems with your project.
Important Concepts for Project
• Variables – When/Where/How?• Time• Loops – When/Where/Why?• Transitions
Variables
• How to make a variable– Go to variables tab– Click create variable– Give Variable a name
• What could variables be used for?
Loops
• How to Loop:– Insert a Forever or a Repeat [ ] times loop– Insert what you want inside it
• When to use a loop– If you repeat the same action several times– To count time
Time
• Count-Down Timer:– Forever– Wait 1 second– Timer=Timer-1
• Time Elapsed:– Forever– Wait 1 Second– Timer=Timer+1
• How to include an Element of time in the game:
Changing Parts with Broadcast and Receive
• Place a [broadcast Scene2] at the end of an event
• Add a [when I receive Scene2] to begin the next level/scene.
Changing Parts with Time• Start with a Forever if Time=20
– Say “I’m going to do something here”
This is the Timer, it controls the clock that everything else will be run on.
This is an event that is triggered when the Time = 9, or when 9 seconds have passed.
This tells the script that the event is finished, and the loop can stop looking for Time=20
Reset
• Add a button (could be when Green Flag is clicked) to reset your game or story.– Show or hide all of the sprites– Reset all of the Variables to their starting value
(usually 0)– Anything else your specific program needs (change
the background, move sprites to a starting position, anything)