240 likes | 574 Views
Scratch Programming. Session 6 of 10 If-then-else statements interactions Final projects specifications. Objectives for Session 6. If Statement If Else Statement Interaction. If Statement. If you are 12, raise your hand If you like baseball, stand up. If Statement Programming View.
E N D
Scratch Programming Session 6 of 10 If-then-else statements interactions Final projects specifications
Objectives for Session 6 If Statement If Else Statement Interaction
If Statement If you are 12, raise your hand If you like baseball, stand up
If Statement Programming View • If ( you are 12) { raise your hand } • If ( you like baseball) { stand up }
If Statement Scratch View True or false test Statements to do only if test is true • The If Statement • Located in the Control Menu
If Statement Practice Let’s create an If Statement Create a variable A Set A to 0 Create an If Statement If A > 2 Perform some Motion Change A to 3
If Statement Practice Try creating the following If Statement on your own If ( A = B ) { Move 5 steps }
If Else Statement • If you like football, raise your hand Else stand up • If you are 11, go to the right side of the room Else go to the left side of the room
If Else Statement If ( you are 11 ) { raise your hand } Else { stand up }
If Else Statement Practice • Loop forever • If the mouse is clicked • Move 10 steps • Else • Turn 15 degrees
If Else Statement Practice Create your own If Else Statement
Interaction • Between two Sprites • Examples • When two Sprites are touching • When one Sprite is clicked by mouse
Interaction Example Start with a blank screen Create another Sprite Make sure your cat is facing the first Sprite
Interaction Example cont. • Add this in for the cat • When space bar clicked • If touching Sprite2 • Say hello • Else • Move 10 steps
Interaction Example cont. • Add this in for the second Sprite • When space bar clicked • If touching Sprite1 • Say I’m standing here
Interaction Practice Create your own example Using Two or Three Sprites Use touching
Review You now know: How to create an If Statement How to create an If Else Statement How to sense touching other Sprites
Final Project Create a story, a lesson, a game, or a simulation Use at least two sprites that interact in some way Use at least two scenes and backgrounds Use some sound and motion Have some properties change, such as size or color, or shape