Unit 3: Intro to Programming Snap! Introduction

Slides:



Advertisements
Similar presentations
Create a Simple Game in Scratch
Advertisements

Create a Simple Game in Scratch
Mission Technology Introduction to Scratch! June 2007.
Getting Started With Alice By Ruthie Tucker under the direction of Prof. Susan Rodger Duke University, July
Code Club Session 3 Shark Eats Fish. Picture of finished product here.
Write Your First Computer Game!. Coding: Programming Languages Just like you can speak Chinese to someone who understands Chinese to tell them what to.
Mrs. Chapman. Tabs (Block Categories) Commands Available to use Script Area where you type your code Sprite Stage All sprites in this project.
Learn… Create… Program. Manipulation of Multiple Media Connects with youth culture Scratch is a new graphical programming language designed to support.
Scratch Workshop Thursday, August 26, 2010.
Adventures in Animation Introduction to Scratch! Michelle Venable-Foster June 2006.
What is Scratch? Scratch as Logo Dr. Ben Schafer Department of Computer Science University of Northern Iowa.
Mr. Wortzman. Tabs (Block Categories) Available Blocks Script Area Sprite Stage All sprites in this project.
Scratch the Cat. Object Oriented Programing Writing computer programs Based on Objects Instead of Actions Based on Data Instead of Logic.
INTRODUCTION TO THE SCRATCH PROGRAMMING ENVIRONMENT.
Code Club Session 2 Dance Party. What will we learn ?  How to change the background  How to create animations  How to make objects talk to each other.
Introduction to Scratch!
Summer Computing Workshop. Session 2 Input in Scratch  Multi-Character input - This is used when the user is prompted to enter a number or word.  Problems.
Exploring Computer Science 2/23/15 2/23 Develop a Scratch story project -Brainstorming 2/24 Develop a Scratch story project –Developing 2/25 Develop a.
Introduction to Scratch Scratch as Logo Dr. Ben Schafer Department of Computer Science University of Northern Iowa.
Section 1 Introduction National 4/5 Scratch Course.
Introduction to Programming G50PRO University of Nottingham Unit 2 : Introduction To Scratch Paul Tennent
Creating a Simple Game in Scratch Barb Ericson Georgia Tech June 2008.
Summer Computing Workshop. Session 3 Conditional Branching  Conditional branching is used to alter the normal flow of execution depending on the value.
Scratch Another computer programming language Developed by MIT in 2003
Create a Halloween Computer Game in Scratch Stephanie Smullen and Dawn Ellis Barb Ericson October 2008.
Computer Programming Modeling a Passive Solar Home.
Unit 1 Introduction to Evangel College S.2 ICT.
From last time… Explore the blue commands from the motion menu Find at least three ways to get the sprite to move to the UPPER LEFT corner.
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
Using MIT Scratch for Programming and Control Exercise 4 – Cat and Dog game Year 9 ICT Autumn Term 2007.
Scratch for Interactivity Dr. Ben Schafer Department of Computer Science University of Northern Iowa.
Adventures in Animation Introduction to Scratch! Michelle Venable-Foster Barb Ericson Dec 2007.
1 CSC 221: Computer Programming I Fall 2009 Introduction to programming in Scratch  animation sprites  motion, control & sensing  costume changes 
Scratch Lesson 1. Creating an account Open the internet browser : Safari or Internet Explorer Type in the URL scratch.mit.edu Using your school computer.
Computer Programming Modeling a Passive Solar Home.
Computer Programming with Scratch JAOIT 8. Scratch Scratch is a programming language that makes it easy to create your own interactive stories, animations,
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
Introducing Scratch Learning resources for the implementation of the scenario
Functions / Blocks.
Review for Final June 13, 2016.
Scratch Programming Cards
Introduction to Scratch
Development Environment
Create a Halloween Computer Game in Scratch
August 31 Intro to CS.
Scratch for Interactivity
Madlib-Input, Strings, and Lists in Scratch
ECS 9/7/17.
Intro to CS Monday, August 29
Intro to CS Monday, August 24
Scratch for Interactivity
Introduction to Object-Oriented Programming
Learning Objective LO: We’re learning to understand when it is appropriate to use particular data types.
Getting Started with Scratch
Motion and Looks.
Go to =>
Introduction to TouchDevelop
Go to =>
Scratch for Storytelling
Go to =>
Getting Started with Scratch
Game Over Module 4 Lesson 2.
Introduction to Snap Programming
Getting Started with Scratch
Creating a Simple Game in Scratch
CSC 221: Introduction to Programming Fall 2018
Presentation transcript:

Unit 3: Intro to Programming Snap! Introduction https://snap.berkeley.edu/SnapManual.pdf

Snap! Interface Inside the Scripting area you pull blocks from the palette to make scripts, as exemplified below Snap! is a visual language; instead of writing a program using the keyboard, the Snap! programmer uses the same drag-and-drop interface familiar to computer users. The five blocks that make up this script have three different colors, corresponding to three of the eight palettes in which blocks can be found. Hat Blocks Command blocks

Technical Vocab A script is a sequence of instructions that tells a computer what to do. A program is a set of scripts. In some programming languages, like Snap, you program by dragging blocks (individual instructions) and snapping them together. In other languages, you type the instructions. The idea is the same. You can use blocks that Snap provides OR you can invent and create your own blocks.

Go to https://bjc.edc.org/bjc-r/course/bjc4nyc.html

Complete Unit 1 Lab 1 https://bjc.edc.org/bjc-r/topic/topic.html?topic=nyc_bjc/1-intro-loops.topic&course=bjc4nyc.html&novideo&noassignment

Unit 1 Lab 1 Page 1: Make your account! Finish Lab 1: Work on Lab 1: Alonzo Game. When you get to the end “Sharing your app” please share it with me! palosaaril@pvpusd.net Subject Line: U1L!: Click Alonzo Game

MAKE SURE YOU SAVE YOUR WORK

The meaning of a block’s shape Hat Blocks (Hat Shape) indicate when the script should be carried out (think event handlers) Hat block names typically start with the word “when” A script isn’t required to have a hat block, but if not, then the script will be run only if the user clicks on the script itself. A script can’t have more than one hat block, and the hat block can be used only at the top of the script; Command Blocks  (Puzzle Shape) Each command block corresponds to an action that Snap! already knows how to carry out in terms of motion.

Reporter / Expressions Blocks (Round Shape) Called a “reporter” because when it’s run, instead of carrying out an action, report a value.

Notice the round block is in the Operators palette, just like +, but in this script it’s a lighter color with black lettering because Snap! alternates light and dark versions of the palette colors when a block is nested inside another block from the same palette

A closer look at those Oval/Round reporter blocks It’s called a “reporter” because when it’s run, instead of carrying out an action, it reports a value that can be used as an input to another block. If you drag a reporter into the scripting area by itself and click on it, the value it reports will appear in a speech balloon next to the block: When you drag a reporter block over another block’s input slot, a white “halo” appears around that input slot, analogous to the white line that appears when snapping command blocks together

Predicate Blocks (Hexagonal Shape) have a Boolean Output (they report True or False). The special shape is a reminder that predicates don’t make sense in an input slot that are expecting a number or text. This wouldn’t make sense: But this does: Conditional Blocks (C-Shape) runs inputted script if predicate returns true.

What is the meaning of a block’s color?

Control (Gold Blocks) Hat Shape Blocks Puzzle Shape Command Blocks EX: the script should be run when the green flag near the right end of the Snap! tool bar is clicked. My personal FAV to use in clearing the screen Hat Shape Blocks Puzzle Shape Command Blocks Conditional Blocks (C-Shape or E-Shape) The generic “when anything” block , is subtly different from the others. When the stop sign is clicked, this block no longer tests whether the condition in its hexagonal input slot is true, so the script beneath it will not run, until some other script in the project runs (because, for example, you click the green flag). HAT BLOCK’s distinctive shape is meant to remind you that is must be on the top PUZZLE SHAPE BLOCKS are also considered command blocks because they tell a script what to do

White Square input slots take either a number or a string. EX: the block tells the sprite (the arrowhead shape on the stage at the right end of the window) to move ten steps in the direction in which the arrowhead is pointing. The number 10 in the move block is called an input to the block. By clicking on the white oval, you can type any number in place of the 10. Motion (Blue) Blocks Puzzle Shape Command Blocks Reporter / Expressions Blocks (Round Shape) White Square input slots take either a number or a string.  

The Pen (Green), Sound (Pink), and Looks (Purple) Blocks Puzzle Shape Command Blocks Reporter / Expressions Blocks (Round Shape)

Sensing (Light Blue) and Operators (Light green) Blocks Puzzle Shape Command Blocks Reporter / Expressions Blocks (Round Shape) Predicate Blocks (Hexagonal Shape) We have our Boolean Operators We can get user input & use it!

Variables (Orange) Blocks This palate has Command Blocks  (Puzzle Shape), Reporter / Expressions Blocks (Round Shape), Predicate Blocks (Hexagonal Shape) TWO MORE IMPORTANT FEATURES OF THIS PALATE: Make a Variable Make a Block (You can make your own function here!) The first version of Snap! was called BYOB, for “Build Your Own Blocks.” This was the first and is still the most important capability we added to Scratch. The name was changed because a few teachers have no sense of humor. You pick your battles.

What should I know about “Sprites”? 1) There can be more than one sprite. Just below the stage is the “new sprite” button . Click the button to add a new sprite to the stage. The new sprite will appear in a random position on the stage, facing in a random direction, with a random color. 2) A sprite doesn’t have to look like an arrowhead, but can have any picture as a costume. You can give a sprite as many costumes as you like, and then choose which it will wear either by clicking in its wardrobe or by using the block in a script. (Every costume has a number as well as a name. ) 3) Each sprite has its own scripts To see the scripts for a particular sprite in the scripting area, click on the picture of that sprite in the sprite corral in the bottom right corner of the window

You Try! Multiple Sprites Try putting one of the following scripts in each sprite’s scripting area: When you click the green flag, you should see one sprite rotate while the other moves back and forth. This experiment illustrates the way different scripts can run in parallel.

4) Sounds in Snap!

5) Sprites can talk to each other using the “Broadcast” feature! Here’s a simple example: In the block, the word “bark” is just an arbitrary name. When you click on the downward arrowhead in that input slot, one of the choices (the only choice, the first time) is “new,” which then prompts you to enter a name for the new broadcast. When this block is run, the chosen message is sent to every sprite, which is why the block is called “broadcast.” Because the boy’s script uses broadcast and wait rather than just broadcast, the boy doesn’t go on to his next say block until the dog’s script finishes. That’s why the two sprites take turns talking, instead of both talking at once. Notice the dots in the SAY BLOCKS In the text input slots, a space character is shown as a brown dot, so that you can count the number of spaces between words, and in particular you can tell the difference between an empty slot and one containing spaces. The brown dots are not shown on the stage when the block is run.

Examples of Broadcast working….

6) You can animate parts of your Sprite… Snap! allows one sprite to be designated as the anchor of the combined shape, with other sprites as its parts. To set up sprite nesting, drag the sprite corral icon of a part sprite onto the stage display (not the sprite corral icon!) of the desired anchor sprite. Sprite nesting is shown in the sprite corral icons of both anchors and parts: Sometimes it’s desirable to make a sort of “super-sprite” composed of pieces that can move together but can also be separately articulated. The classic example is a person’s body made up of a torso, limbs, and a head.

U1L2 Classwork

Recall U1L1 Page 7 gave the following directions: http://bjc.edc.org/bjc-r/cur/programming/1-introduction/1-building-an-app/7-loading-mobile-device.html?topic=nyc_bjc%2F1-intro-loops.topic&course=bjc4nyc.html&novideo&noassignment

HW: Intro to Snap! Make a Story Project Big Idea: Creativity 50 pts Phase 1: Decide on a background and at least 2 sprites in costumes. Be creative AND APPROPRIATE! Phase 2: Brainstorm a situation that they might be in. Story should include movement (motion), words (the Say and Broadcast/or Tell blocks should be used) Should take about 45 seconds - 1 minute to run. You will email me the URL before midnight on Sunday night. Late will loose points.