INTRODUCTION TO THE SCRATCH PROGRAMMING ENVIRONMENT.

Slides:



Advertisements
Similar presentations
Introduction to Macromedia Director 8.5 – Lingo
Advertisements

Create a Simple Game in Scratch
Summer Computing Workshop. Introduction to Variables Variables are used in every aspect of programming. They are used to store data the programmer needs.
SCRATCH Lesson Two – Interactive Concepts Using Sensing, Operators, and Variables.
Create a Simple Game in Scratch
Scratch is a Visual Programming Language
Scratch for Storytelling Dr. Ben Schafer Department of Computer Science University of Northern Iowa.
1 An intro to programming concepts with Scratch Session 3 of 10 sessions Repetition and variations.
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.
Scratch Programming Session 9 of 10 Review elements to use in stories, games, etc.
1 An introduction to programming concepts with Scratch.
Scratch Understanding some programming techniques using Scratch Resetting, Parallelism and Events.
Digital Art in Scratch part 1 Barb Ericson Georgia Tech Oct 2010.
What is Scratch? Scratch as Logo Dr. Ben Schafer Department of Computer Science University of Northern Iowa.
INTRODUCTION TO SCRATCH. About Me Resources Scratch Website Learn Scratch Washington-Lee Computer.
Mr. Wortzman. Tabs (Block Categories) Available Blocks Script Area Sprite Stage All sprites in this project.
Fish Chomp. The screen where you can see what happens when you play your game is called the STAGE. The SCRIPT BANK is where the types of instructions.
Scratch the Cat. Object Oriented Programing Writing computer programs Based on Objects Instead of Actions Based on Data Instead of Logic.
In.  This presentation will only make sense if you view it in presentation mode (hit F5). If you don’t do that there will be multiple slides that are.
Ms. Deveny Second Semester  Introductions  Interview your table partner  Name  Why taking CPD  Computer experience  Favorite game?
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.
Spiral Rider PAGE 1. Set Up Scene 1.Add Stage-underwater scene 2.Add crab sprite 3.Add two fish sprites PAGE 2.
Using MIT Scratch for Programming and Control Exercise 3 Ball Game Year 9 ICT Autumn Term 2007.
Programming & Scratch. Programming Learning to program is ultimately about learning to think logically and to approach problems methodically. The building.
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.
How to make a Shooting Target game in Scratch!. WE ARE GOING TO MAKE A TARGET GAME. This game will have: A Target that will move when clicked. A Timer.
1 Understand how to use Scratch to: – Animate a sprite – Add sound to your script – Use the forever command to create a loop Lesson 2: Learning Objectives.
Introduction to Programming G50PRO University of Nottingham Unit 2 : Introduction To Scratch Paul Tennent
Digital Art in Scratch part 1 Barb Ericson Georgia Tech May 2011.
Fish Chomp. The screen where you can see what happens when you play your game is called the STAGE. The SCRIPT BANK is where the types of instructions.
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.
Making a Sprite Dance Barb Ericson Georgia Tech June 2011.
Create a Halloween Computer Game in Scratch Stephanie Smullen and Dawn Ellis Barb Ericson October 2008.
Computer Programming Modeling a Passive Solar Home.
1 Project designed and created by M. Shajith Kumar.
24 Background Building 25 Computing Terminology, and Speed/Velocity Module 4 Notes: Sensing, Or Operator, Conditional Logic 28 Module 4 Algorithms,
Cloning in Scratch Computer App Session 6. Cloning in Scratch Learning Objectives: I will clone sprites in Scratch to create copies of an existing sprite.
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
Scratch for Interactivity Dr. Ben Schafer Department of Computer Science University of Northern Iowa.
How to create a basic game in Scratch. The Scratch Stage The Scratch stage is 480 pixels wide and 360 pixels high x increasesx decreases.
1 CSC 221: Computer Programming I Fall 2009 Introduction to programming in Scratch  animation sprites  motion, control & sensing  costume changes 
Scratch Part 2 – Character Commands. What does a command do?  Commands in programming allow an object whatever it is to do something. In the case of.
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,
Introduction to Programming with Scratch Exploring Computer Science – Lesson 4-1.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
Introducing Scratch Learning resources for the implementation of the scenario
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
Functions / Blocks.
Scratch Programming Cards
Introduction to Scratch
Create a Halloween Computer Game in Scratch
Programming & Scratch.
Scratch for Interactivity
Scratch Unit Overview We are going to look at computer programming and how to create your very own computer game The piece of software we will be using.
Scratch: iteration / repetition / loops
ECS 9/7/17.
Scratch for Interactivity
Introduction to Object-Oriented Programming
Introduction to.
Go to =>
Welcome to SCRATCH.
Creating a Simple Game in Scratch
CSC 221: Introduction to Programming Fall 2018
Presentation transcript:

INTRODUCTION TO THE SCRATCH PROGRAMMING ENVIRONMENT

What is Scratch?  Developed by the “life-long kindergarten” group at MIT  Simple, “code-free” style that lets you write programs by visually combining ‘blocks’  Built-in graphics and sound  Share Projects online  Made for beginners, but ‘expert-level’ programs are possible

Main Scratch Window Performance Area = Stage (background) + Sprites (characters) Pick a Sprite to program Scripts tab: add commands for Sprite1’s actions Script Inventory (block palette): drag new commands from here to the scripts tab Block Types (more to follow) Start (optional) and Stop Buttons

Block Shapes  Trigger:  Statement  Ending Statement  Boolean (true/false) value  Numeric or Text value

Block Types  Blocks are sorted into categories:  Motion: move a sprite  Looks: change costume/color  Sound: play instrument, song  Pen: draw lines on stage  Control: have sprite make ‘decisions’  Sensing: See/hear/touch objects  Operators: mathematics and text  Variables: give sprites memory

Motion Blocks

Looks Blocks

Sounds Blocks

Pen Blocks

Control Blocks

Sensing Blocks

Operator Blocks

Variable Blocks

A Simple Manual Program Click on the block to make the sprite walk 10 steps

The GO Button This trigger block will make any attached script run when the green flag is clicked. This is a good way to start multiple scripts at the same time.

Add some control Question: How many steps will Sprite1 take?

About Loops  Repeat loop: simplest type  Whatever is inside, do that same thing as many times as it says in the top of the block  Equivalent (but tedious!) solution:  Copy/paste ‘move 10 steps’ 30 times  Not feasible if you want to repeat something 1000 times  We’ll learn about the other two loop types later:  Forever  Repeat until

Stuck! Our Sprite walked as far as he’s allowed and is now stuck! Here are some possible solutions: Click on the sprite and move him back to the center (MANUAL strategy) Some sprites can walk off and disappear! Add a script that walks backward 300 steps (UNDO strategy) Use Motion blocks to ‘transport’ Sprite1 to a fixed location (RESET strategy)

Motion Explained  The stage is set on an X-Y plane  ‘Move 10 steps’ moves about 10 steps on the grid  But you can turn to move in different directions  ‘Go to x: 0 y: 0’ puts Sprite1 in the center of screen  Lower-right shows coordinates of mouse pointer  Xposition, Yposition: current location of a sprite  Can be used for boolean testing, or for drawing shapes in certain locations X Y

What’s Going On?  Scratch tends to ‘go with the flow’  Whatever script you run, Scratch will run it as best as it can  After the script runs, the effects remain  Can lead to unintended outcomes  This is actually kind of annoying  Testing must always have the same initial situation  Games always start in level 1  We’re used to having a ‘reset’ button when our programs develop problems  Returns us to the initial error-free configuration  Scratch doesn’t have one, but we can make one

Green-Flag Reset Reset Script: return to whatever initial situation you want Sprite Positions (motion) Pen Markings Variable Values (more later) Green-Flag Reset: Upside: Green flag acts as both ‘start’ and ‘reset’ button Downsides: Other green-flag scripts will start running right away Human must force reset

Keyboard Reset Keyboard Reset: run reset script when a certain key is pressed (can choose any key) Upside: Good when testing non-green flag scripts (so the other green flag scripts don’t run) Downside: A human is still in charge of re- setting

Subroutines  Subroutine:  A script that can be run by itself to some useful effect  Can be executed independently by the computer or initiated by a human  Re-use Property: the more a subroutine can/will be re-used, the more valuable it is  When combined with abstraction, subroutines make programs feel simpler  Real-world examples:  Cooking: “Separate the yolks from the whites”  Driving: “Take Exit 9”  Others?

Reset Subroutine Subroutines have a: Definition: The actual subroutine script, starting with a ‘When I receive ’ trigger block Call: Subroutines do nothing unless called upon to execute, via a ‘broadcast (and wait)’ command Calls can be attached to human input (above) or computer control (next slide)

Computer Controlled Subroutine  Modified walking script:  Repeating 100 times,  Move 10 steps  If I reach the edge of the stage: Call the reset subroutine  After I’ve done the above 100 times, call the reset subroutine one more time

Summary  Scratch: Easy to get started programming, no experience required  Different block types: allow us to modify a Sprite’s behavior in different ways  Script: One or more blocks fastened together  Complex combinations lead to complex behavior!  Loops: Abstraction for repetitive processes  Subroutines: Allow fast re-use of a script by humans or the computer