AdvancedProgrammingWithScratch
AdvancedProgrammingWithScratch
Scratch
Slides
• Many of these Scratch slides come from here:
– h:p://cs.harvard.edu/malan/scratch
– h:p://scratched.gse.harvard.edu/
– h:ps://courses.edx.org/courses/course-
v1:HarveyMuddX+CS002x+2T2016/course/
2
Pen
• Scratch has a secret!
• The Sprites are carrying a pen!
• You can tell it to put the pen down.
• Then when the cat moves, he draws a line!
• What happens when you do this?
• Larger Circle
• Perimeter is 540 (360 X 1.5)
Blocks
• Similar to FuncWons/methods
• Make a new block. Call it draw square.
• Now you can add the logic to draw a square
and call it whenever you want.
• Let’s try!
• Click edit – you can add input if you want the
person calling draw square to specify
something like size of square.
Create a new Block
NegaWve Steps?
• What do you think would happen if I moved
-100 steps?
Variables
• In programming, a variable is a placeholder
for some value, much like x and y are popular
variables in algebra.
• In Scratch, variables are represented with
blocks shaped like elongated circles, uniquely
labeled by you.
Variables
• Counter – let’s watch the variable change
Variables and CondiWons