Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Programming G50PRO University of Nottingham Unit 2 : Introduction To Scratch Paul Tennent http://paultennent.wordpress.com/G50PRO.html.

Similar presentations


Presentation on theme: "Introduction to Programming G50PRO University of Nottingham Unit 2 : Introduction To Scratch Paul Tennent http://paultennent.wordpress.com/G50PRO.html."— Presentation transcript:

1 Introduction to Programming G50PRO University of Nottingham Unit 2 : Introduction To Scratch
Paul Tennent Room C41

2 What is Scratch? Scratch is a free programmable toolkit that enables users to create games, animated stories, and interactive art Enables users to share programs over the Internet Scratch is developed by the Lifelong Kindergarten Group at the MIT Media Lab, with funding from the National Science Foundation, Microsoft, Intel Foundation, Nokia, and the MIT Media Lab research consortia.

3

4 Getting Started With Scratch
Open new project Choose, create or edit your Sprite Choose your background Write your program

5 Programming In Scratch
Click on the sprite you want to program, and select the “Scripts” tab. The Scripts area is where you “build” your program by using the programming blocks. In the upper, left-hand corner of your Scratch window, you will see 8 buttons . Each of these buttons have programming blocks in those particular areas.

6 Programming In Scratch
To program a sprite, drag blocks from the Blocks Palette to the Scripts Area. To run a block, click on it. Create scripts (programs) by snapping blocks together into stacks. Click anywhere on the stack to run the whole script, from top to bottom

7 Scratch Stage The Scratch stage is 480 pixels wide and 360 pixels high. 180 240 -240 -180

8 Scratch Blocks Motion Control and Sensing Animate sprites
controls how many times an event happens, how long an event happens, or when an event happens. conditional statements (“if statements” or “if-else statements”) Write code so that if the user presses the Space key on the keyboard, the sprite will move 20 steps and change direction.

9 Scratch Blocks Sound Looks Pen Operators Variables

10 Starting From Scratch Scratch has all of the common elements used in all programming languages. Conditional statements Loops Variables Events

11 Branching (Conditional Statements)
Make Tea START Is kettle full? Fill kettle yes no Boil Kettle

12 Conditional Statements
If [Boolean] Then Do this Else Do the other

13 Comparisons == Equals < Less than > More than
<= Less than or equal to >= Greater than or equal to != Not equal to

14 Loops Simplify the coding of repetitive tasks
Giving the people in a company a 10% rise Employee 1 salary = 1.1*Employee 1 salary Employee 2 salary = 1.1*Employee 2 salary Employee 99 salary = 1.1*Employee 99 salary

15 Loops Simplify the coding of repetitive tasks
Giving the people in a company a 10% rise For i = 1 to 99 Employee i salary = 1.1*Employee i salary

16 Loops There are a lot of different standard types of loop
Scratch only has some of them

17 Flow control Flow control
In computer science flow control refers to the order in which the statements or instructions are executed or evaluated. Branches (Conditional Statements) Loops

18 Variables a variable is a facility for storing data
One of the most powerful features of a programming language is the ability to manipulate variables. A variable is a named location that stores a value. Values are things that can be printed, stored or operated on. (numbers, letters, Strings, etc.)

19 Variables each variable will have Name Value Location in memory
X = 100 Y = 20

20 Assignment statement Declare str str = “Hello”
the idea is straightforward: When you declare a variable, you create a named storage location. When you make an assignment to a variable, you give it a value.

21 BankBalance Payment 700 700 Check Balance 700

22 Events You can’t run all of the elements of a program at once
Things happen when the relevant event triggers them The main event in Scratch is the green flag There are other custom events that you can add

23 Summary Scratch Programming Blocks
Conditional Statements allow us to make decisions about what to do next Loops allow us to perform repetitive tasks Variables record the values and state of elements of a program Events trigger different elements of the program to be run at the correct time


Download ppt "Introduction to Programming G50PRO University of Nottingham Unit 2 : Introduction To Scratch Paul Tennent http://paultennent.wordpress.com/G50PRO.html."

Similar presentations


Ads by Google