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.

Slides:



Advertisements
Similar presentations
Sprite-visual object (actor on the stage) Scripts- Tells actors (sprites) what to do.
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.
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Create a Simple Game in Scratch
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
1 An introduction to programming concepts with Scratch.
An intro to programming concepts with Scratch Session 2 of 10 sessions I/O, variables, simple computing.
Scratch Understanding some programming techniques using Scratch Resetting, Parallelism and Events.
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.
Learning to program using Minecraft. Learning Objective Know what Minecraft is and to explain some of it’s uses Build a simple house in creative mode.
Scratch the Cat. Object Oriented Programing Writing computer programs Based on Objects Instead of Actions Based on Data Instead of Logic.
The Scratch Calculator You are all going to be real computer programmers!!!
Summer Computing Workshop. Session 4 Loops  At the heart of their functionality, loops enable blocks of code to be executed more than once  Loops represent.
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.
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!
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Using MIT Scratch for Programming and Control Exercise 3 Ball Game Year 9 ICT Autumn Term 2007.
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.
Section 2 Variables National 4/5 Scratch Course. What you should know after this lesson What a variable is Where variables are stored How to get data.
Exploring Computer Science 2/16/15
Summer Computing Workshop. Introduction  Boolean Expressions – In programming, a Boolean expression is an expression that is either true or false. In.
Section 1 Introduction National 4/5 Scratch Course.
Introduction to Programming G50PRO University of Nottingham Unit 2 : Introduction To Scratch Paul Tennent
Summer Computing Workshop.  This workshop is designed to introduce basic programming concepts through the use of the highly intuitive programming environments.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech June 2008.
Introduction to Scratch. What is Scratch? Scratch is a control program that enables you to create your own interactive stories, animations, games, music,
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.
1 Project designed and created by M. Shajith Kumar.
Variables and Random Numbers Computer App Session 4.
Using MIT Scratch for Programming and Control Exercise 1 Creating movement Year 11 DTG 2012.
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.
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 1 Intro to Digital Technology.
Scratch for Interactivity Dr. Ben Schafer Department of Computer Science University of Northern Iowa.
Today's Ninja Challenge: Write Your First Computer Game!
ICT/COMPUTING RULES Only use software allowed by the teacher
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.
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,
Teaching Kids Programming with Chromebook Digital Convergence Lab, NIU.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
Introducing Scratch Learning resources for the implementation of the scenario
School of Computer Science Space School 2015 Programming a Lunar Lander Game.
Review for Final June 13, 2016.
Create a Halloween Computer Game in Scratch
Scratch for Interactivity
Madlib-Input, Strings, and Lists in Scratch
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.
Spanish Mad libs with Scratch
Introduction to Object-Oriented Programming
Introduction to.
Learn… Create… Program
Learn… Create… Program
Maze Race. Maze Race Race The first thing you need to do is change the background so click on stage. Then click on background. Now click paint Select.
An intro to programming concepts with Scratch
Learn… Create… Program
Learn… Create… Program
Creating a Simple Game in Scratch
Presentation transcript:

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 with multi-character input - Possible problem with type differences  Single-character input – This is mainly used to key specific events (an example may be moving a sprite when an arrow key is pressed)

Asking Questions  Now we will discuss how to ask the user for a word or number which can then be used in the script. We will do this by having the sprite ask the user his/her name and then replying using the name.  Click sensing and drag an block to the center scripts menu. We want the program to start when the green flag is clicked so do what is necessary. If it isn’t already written, click in the small text field within the block and type the question “What’s your name”.  Now drag a block and join it to the bottom of the block

Asking Questions  Since we want the sprite to answer with the name and a short sentence, we need the special block which is located in the operators section.  The goal is to place something such as “Great to meet you” into the left text field. Drag the answer block (found in sensing) to the right text field. This joining is called concatenation.  We want the join block inside of the say block so now let’s construct the example. (see example 2.1 on the Constructed Examples page at the end of this section)

Using number input  Lets do a small project that uses a sprite to ask the user how many steps he/she wants the sprite to move (refer to example 2.1 if you need help)  Now that we have a script that does this, what do you think will happen if we entered a word instead of a number? Try it and see if you were correct.  The sprite doesn’t move!! This brings up the topic of different data types. In Java, C++, and other programming languages, the programmer must specify what type of data it is before the data can be used. In Scratch the two data types are words and numbers. Other programming languages may not properly run if data types are incompatible. Scratch runs the program but doesn’t perform the action if the type is incompatible. It is difficult for the sprite to move “word” steps.

Movement blocks  To enable the sprite to move by using single character input, we must first learn some of the most used motion blocks  Drag a and a to the center section  By using these blocks we can move the sprite any direction on the x and y axis.  Change x moves the sprite along the x axis, a negative number left, a positive number moving it right  Change y moves the sprite along the y axis, a negative number moving it down, a positive number moving it up

Single Character Input  Now we have movement blocks on the screen, we only have two directions so we must duplicate both blocks so our sprite can move all four directions (up, down, left, right)  After we have four blocks on the screen, change the number in one of the change x blocks to negative and the same for a change y block.  Now drag a block to the center and duplicate it three times so we have a total of four  Now we will construct the example (see example 2.2 on the Constructed Examples page at the end of this section)

Single Character Input  Now we will do an example using another simple new concept. The special block we will be using allows the user to change the direction the sprite is facing.  First choose a sprite (preferably one that has a top down view)  Drag four blocks to the center window  Since we have 4 directions to move, we must have 4 key pressed blocks and 4 move blocks  All of these will work together to move the sprite and face the sprite in the direction the user entered  Construct example (see example 2.3 on the Constructed Examples page at the end of this section)

Constructed Examples Example 2.1Example 2.2 Example 2.3

Session 2 Project  Create a small animation using single and multi- character inputs. Use single-character input to key events or move a sprite about the screen. Use multi-character input to ask for a question, the Sprite must respond to the question using the answer to the question.

Session 2 Questions 1. What are two different types of input? 2. Scripts are made up of one or more _____? 3. Explain the flow of execution in a script/method. 4. For what might we use multi-character input? 5. For what might we use single-character input?