Presentation is loading. Please wait.

Presentation is loading. Please wait.

Intro to CS Monday, August 29

Similar presentations


Presentation on theme: "Intro to CS Monday, August 29"— Presentation transcript:

1 Intro to CS Monday, August 29

2 Today’s Objectives Review SNAP! one more time Explore More Blocks
If/Else Repeat Forever Broadcast Ask/Answer Boolean (and, or, not) Global and Local

3 SNAP! User’s Manual http://snap.berkeley.edu/SnapManual.pdf
Ch 1. Blocks, Scripts, Sprites Ch 2. Saving and Loading projects Ch 3. Building a Block Ch 4. First Class Lists Ch 5. Typed Inputs Ch 6. Procedures as Data Ch 7. Object Oriented Programming Ch 8. The Outside World Ch 9. Continuations Ch 10. User Interface Elements Index

4 The Actors in the “Play”
The Stage Actor 1 (Sprite 1) Actor 2 (Sprite 2) Actor 3 (Sprite 3) Scenery Script 2 Script 3 Script 1 Costume 1

5

6 Customizing a Costume

7 Example: Find a Mario costume
First, find one you like. One way is to search for “mario” in Google Images. Then drag the one you like to your desktop.

8 Example: Find a Mario costume
Then, import it as a costume for one of your Sprites by dragging it from your desktop.

9 Exercise 1: Add, remove and reposition sprites
Find an image that you would like for your Sprite Add it to your workspace as a Sprite “costume” Replace existing costume with your new one Repeat this process – but only this time draw a STICKMAN Sprite with one leg longer than the other using the graphical editor.

10 What worked? What was difficult?
Lab Exercise 1 Recap: Discussion What worked? What was difficult?

11 Lab Exercise 2: Rotation
Create this simple script, then run it. Pick your stickfigure figure Sprite with one leg purposely longer than the other TIMING: 4 mins (total 8Mins) ACTUAL: 4 min (10 total), Today, let’s do a deeper dive into the Pen block set. Who can tell me what these do: - Pen Up - Pen Down - Clear - Set Pen Color? - Set Pen Shade - Stamp Who can tell me what the following block does?

12 Lab Exercise 2: Rotation
Did any of you get this? Why? Click each of the three buttons and try it again. What was different? What happens with “rotate 180 degrees?” TIMING: 4 mins (total 8Mins) ACTUAL: 4 min (10 total), Today, let’s do a deeper dive into the Pen block set. Who can tell me what these do: - Pen Up - Pen Down - Clear - Set Pen Color? - Set Pen Shade - Stamp Who can tell me what the following block does?

13 Did any of you get this? Why?
Lab Exercise 2: Recap Did any of you get this? Why? TIMING: 4 mins (total 8Mins) ACTUAL: 4 min (10 total), Today, let’s do a deeper dive into the Pen block set. Who can tell me what these do: - Pen Up - Pen Down - Clear - Set Pen Color? - Set Pen Shade - Stamp Who can tell me what the following block does? can rotate only face left/right can’t rotate

14 What worked? What was difficult?
Lab Exercise 2 Recap: Discussion What worked? What was difficult?

15 Exploring More Blocks: Variables
What is a GLOBAL VARIABLE? When would you use a GLOBAL variable instead of a SCRIPT variable?

16 Exploring More Blocks: Broadcast
What does this do? It puts the scripted value into “message”

17 Exploring More Blocks: Ask and Answer
What does this do? It puts the value typed by the keyboard into “answer”

18 Question? What are the differences between When would you use each?

19 Example of all 3 at once

20 Lab Exercise 3: Variables
There is a problem with this script. Can you find it? Write your own script that fixes it.

21 What worked? What was difficult?
Lab Exercise 3 Recap: Discussion What worked? What was difficult?

22 Exploring More Blocks: Sensing

23 Exploring More Blocks: Control
These CONTROL blocks control the operation of the SCRIPT. (As opposed to SENSING blocks that control the SPRITE.) What do they do?

24 Exploring More Blocks: Operators
What is a BOOLEAN OPERATOR? How do these work? Conditions that when evaluated result in the answer of “true” or “false.”

25 Exploring More Blocks: Boolean Operators
If BOTH Condition “A” and Condition “B” are true, then TRUE If EITHER Condition “A” or Condition “B” is true, then TRUE If NOT Condition “A” then TRUE When you NEST boolean operators, solve inside out

26 AND (both have to be true)
Battery Switch A Switch B Switch A closed Switch B closed? Lightbulb ON No Yes YES!

27 OR (either one has to be true)
Battery Switch A Switch B Switch A closed Switch B closed? Lightbulb ON No Yes YES!

28 OR (either one has to be true)
Battery Switch A Switch B Switch A closed Switch B closed? Lightbulb ON NOT Switch B closed? (Switch B NOT closed) Lightbulb On? No Yes YES! Yes No YES! No

29 Lab Exercise 4: If/Else & Boolean
Start with your Lab 3 script. Add a variable that counts the number of times your Sprite has hit an edge. Call it “# WALL HITS.” If the Sprite hits the wall AND the # wall hits is less than 3, change directions and keep going. If the Sprite hits the wall, and the # wall hits is 3 or more, then say Game Over and stop.

30 What worked? What was difficult?
Lab Exercise 4 Recap: Discussion What worked? What was difficult?

31 Review: Today Reviewing the SNAP! IDE Costumes More Blocks
Stage, Palette, Blocks, Scripting area, Toolbar Costumes Import, Draw, Rotation More Blocks Control: forever, repeat, if, if/else, wait Sensing: ask/answer; broadcast/message Variable: global, script Operators: and, or, not

32 Reminders Read Chapter 2 before the start of class on Wednesday, September 2nd Quiz – Sept 6nd Test on Friday, Sept9 on computer parts and SNAP!


Download ppt "Intro to CS Monday, August 29"

Similar presentations


Ads by Google