Lesson 3.1 Variables.

Slides:



Advertisements
Similar presentations
Summer Computing Workshop. Introduction to Variables Variables are used in every aspect of programming. They are used to store data the programmer needs.
Advertisements

Mrs. Chapman. Tabs (Block Categories) Commands Available to use Script Area where you type your code Sprite Stage All sprites in this project.
Session 5 of 10 Review + Multiple Sprites
Madlib-Input, Strings, and Lists in Scratch Barb Ericson Georgia Tech June 2011.
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!!!
Multiplying Whole Numbers and Decimals Lesson 2-2.
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.
ACO 101 Making a program. mb_your_brain_on_improv.html mb_your_brain_on_improv.html.
Python Programming Using Variables and input. Objectives We’re learning to build functions and to use inputs and outputs. Outcomes Build a function Use.
Work with Variables Section 5. Add a variable Click on the top grey portion of the GPA column to highlight the column. At the top left of your screen,
ResponseCard XR Answering Questions. Polling The host computer must be able to receive your responses, but it can only do so when the polling is open.
Variables. Todays Lesson  In todays lesson you are going to:  Learn to use variables  Learn to ask for user input  Learn to save the users response.
TRIGGERS Triggers tell a script to start executing There are four types of triggers: When green flag is clicked When I am clicked When is pressed When.
Create a Halloween Computer Game in Scratch Stephanie Smullen and Dawn Ellis Barb Ericson October 2008.
Using MIT Scratch for Programming and Control Exercise 1 Creating movement Year 11 DTG 2012.
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
1 Project 2: Using Variables and Expressions. 222 Project 2 Overview For this project you will work with three programs Circle Paint Ideal_Weight What.
Programming a Shooter Game Design.
PHP Form Processing * referenced from
Introduction to Scratch We will be using the Scratch Environment today, so please log in to the Scratch website (scratch.mit.edu)
Scratch Programming Cards
Mr Barton’s Maths Notes
Create a Halloween Computer Game in Scratch
Exploring Mathematical Relationships Module 5: Investigation 1
Broadcasting (Adding a new level)
Games Programming in Scratch
Scratch for Interactivity
Exploring Mathematical Relationships Module 5: Investigation 3
Building with Numbers Module 4: Investigation 3
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.
UNIT 1 TEST REVIEW ALGEBRA II
Conservation of Energy
Spanish Mad libs with Scratch
Advanced EasyC Jim Cline July 20-21, 2017.
Algebra 7. Solving Quadratic Equations
Intro to CS Monday, August 29
Intro to CS Monday, August 24
Scratch for Interactivity
Introduction to Object-Oriented Programming
Multiplication Grids Multiplying a 2 digit number by a 1 digit number.
Creating Variables Output Logic flow Operators (More) Basic blocks
CS 115 Lecture Graphics II – coordinate systems, Text, Entry, aliases
Introduction to TouchDevelop
Alice Variables Pepper.
Multiplication Grids Multiplying a 2 digit number by a 1 digit number.
Go to =>
Introduction to TouchDevelop
Using the sensor Lesson 5.
Objective of the lesson
Lesson 3.2 Review: Identifying concepts
Go to =>
An intro to programming concepts with Scratch
Go to =>
Inputs and Variables Programming Guides.
Objective 1.02 Understand Numbering Systems
Mr Barton’s Maths Notes
Building a Game in Scratch
Game Over Module 4 Lesson 2.
4 + (-5) = A. Start at zero B. Move ______ spaces ___________ to get to the first number. C. From there, move _____ spaces __________ D. My final answer.
Basic Lessons 5 & 6 Mr. Kalmes.
Using the sensor Lesson 5.
Introduction to Python
Basic Mr. Husch.
Python 10 Mr. Husch.
Creating a Simple Game in Scratch
Lesson One Movement.
Lesson Nine Variables.
Presentation transcript:

Lesson 3.1 Variables

Working with variables I You’ll need this guy -> Write a script that: Asks for your name Says “Hello [your name]” Write another script that: Asks for your class (freshman, sophomore, junior, or senior) Says “You are a [your class]” Finally try to write a script that: Asks for your class Says “Hello [your name] the [your class]”

Working with variables I You’ll need this guy -> Write a script that: Asks for your name Says “Hello [your name]” Write another script that: Asks for your class (freshman, sophomore, junior, or senior) Says “You are a [your class]” Finally try to write a script that: Asks for your class Says “Hello [your name] the [your class]”

Working with variables I You’ll need this guy -> Write a script that: Asks for your name Says “Hello [your name]” Write another script that: Asks for your class (freshman, sophomore, junior, or senior) Says “You are a [your class]” Finally try to write a script that: Asks for your class Says “Hello [your name] the [your class]”

Working with variables I You’ll need this guy -> Write a script that: Asks for your name Says “Hello [your name]” Write another script that: Asks for your class (freshman, sophomore, junior, or senior) Says “You are a [your class]” Finally try to write a script that: Asks for your class Says “Hello [your name] the [your class]” That doesn’t look right…

Working with variables I For that last part, why couldn't I reuse for my name? Because changed from “Bobby” to “Senior” Why did that happen? Because I entered a new answer with How would you define ? holds the last response the user entered for Variables are like boxes: The name of the variable, “answer”, is just a label The value of the variable, “Bobby” / “Senior”, is what we actually use

Working with variables I For that last part, why couldn't I reuse for my name? Because changed from “Bobby” to “Senior” Why did that happen? Because I entered a new answer with How would you define ? holds the last response the user entered for Variables are like boxes: The name of the variable, “answer”, is just a label The value of the variable, “Bobby” / “Senior”, is what we actually use

Working with variables I For that last part, why couldn't I reuse for my name? Because changed from “Bobby” to “Senior” Why did that happen? Because I entered a new answer with How would you define ? holds the last response the user entered for Variables are like boxes: The name of the variable, “answer”, is just a label The value of the variable, “Bobby” / “Senior”, is what we actually use

Working with variables I For that last part, why couldn't I reuse for my name? Because changed from “Bobby” to “Senior” Why did that happen? Because I entered a new answer with How would you define ? holds the last response the user entered for Variables are like boxes: The name of the variable, “answer”, is just a label The value of the variable, “Bobby” / “Senior”, is what we actually use

Working with variables I When I enter “Bobby” as the answer, “Bobby” gets stored in a variable called answer. “Bobby” is now the value of answer. When I enter “Senior” as the answer, “Senior” gets stored in answer and is the new value. What happens to “Bobby”? The old value is gone forever. “Bobby”

Working with variables I When I enter “Bobby” as the answer, “Bobby” gets stored in a variable called answer. “Bobby” is now the value of answer. When I enter “Senior” as the answer, “Senior” gets stored in answer and is the new value. What happens to “Bobby”? The old value is gone forever. “Senior” “Bobby”

Working with variables I When I enter “Bobby” as the answer, “Bobby” gets stored in a variable called answer. “Bobby” is now the value of answer. When I enter “Senior” as the answer, “Senior” gets stored in answer and is the new value. What happens to “Bobby”? “Senior” “Bobby” “Bobby”

Working with variables I When I enter “Bobby” as the answer, “Bobby” gets stored in a variable called answer. “Bobby” is now the value of answer. When I enter “Senior” as the answer, “Senior” gets stored in answer and is the new value. What happens to “Bobby”? The old value is gone forever. “Senior” “Bobby” “Bobby” “Bobby”

Working with variables I How could we prevent “Bobby” from getting lost forever? By putting it in another variable! We create a new variable name and set its value to “Bobby” Now when the value of answer gets set to “Senior” its safe to throw away the value “Bobby” since it’s saved in name

Working with variables I How could we prevent “Bobby” from getting lost forever? By putting it in another variable! We create a new variable name and set its value to “Bobby” Now when the value of answer gets set to “Senior” its safe to throw away the value “Bobby” since it’s saved in name “Bobby”

Working with variables I How could we prevent “Bobby” from getting lost forever? By putting it in another variable! We create a new variable name and set its value to “Bobby” Now when the value of answer gets set to “Senoir” its safe to throw away the value “Bobby” since it’s saved in name “Bobby” “Bobby” “Senior” “Bobby”

Working with variables I Try that last part again, write a script that: Asks for your name Asks for your class Says “Hello [your name] the [your class]”

Working with variables I Try that last part again, write a script that: Asks for your name Asks for your class Says “Hello [your name] the [your class]” Class wasn’t needed, but it’s a good habit to get into to always save user input to a variable

Working with variables II Modify this script to draw the correct number of squares of the correct size based on user input

Working with variables II Modify this script to draw the correct number of squares of the correct size based on user input

Working with variables III Write a SNAP script that moves a sprite from a top down view.​ The sprite should always be facing the direction it is moving. up arrow = move up 1 steps​ down arrow = move down 1 steps​ right arrow = move right 1 steps​ left arrow = move left 1 steps​ Let’s speed this guy up, add a boost button space = glide 1 secs 100 steps in current direction

Working with variables III Write a SNAP script that moves a sprite from a top down view.​ The sprite should always be facing the direction it is moving. up arrow = move up 1 steps​ down arrow = move down 1 steps​ right arrow = move right 1 steps​ left arrow = move left 1 steps​ Let’s speed this guy up, add a boost button space = glide 1 secs 100 steps in current direction

Working with variables III