Home » coding » Scratch

Category Archives: Scratch

Boolean logic

How to program in Scratch, using Boolean logic

  • Boolean operators include:
  • AND, OR, NOT,  < ,  = ,  >
  •    In other words, is one sprite touching some other thing? The answer by definition must be true or false.
  •    In other words, is one sprite touching something of a certain color? The answer by definition must be true or false.
  •  In other words, is a certain key being pressed?
  •  In other words, is the mouse being used?
  • Why use Boolean operators?
  •   To focus a search, particularly when your topic contains multiple search terms.
  •   To connect various pieces of information to find exactly what you’re looking for.
  • https://sites.google.com/a/onalaskaschools.com/tech/boolean-search-tools
  • .
  • https://ircutp.wordpress.com/utp-irc-faqs/boolean-operators/


A Boolean block is a hexagonal block (shaped after the Boolean elements in flowcharts)
The block contains a condition. The answer to the condition will be either true or false.
It’s important to determine if a statement (expression) is “true” or “false”.
Ways to determine TRUE and FALSE are prevalent in all kinds of decision making.
A mathematically precise way of asking if something is TRUE or FALSE is called a Boolean operation.
It is named after George Boole, who first defined an algebraic system of logic in the mid 19th century.
Boolean data is associated with conditional statements. For example, the following statement is really
a set of questions that can be answered as TRUE or FALSE.
IF (I want to go to a movie) AND (I have more than $10) THEN (I can go to the movie)
We can combine several “boolean” statements that have true/false meaning into a single statement
using words like AND and OR, and NOT).
“If I want to go to the movie AND I have enough money, then I will go to the movie.”
BOTH conditions have to evaluate to true (have to be true) before the entire expression is true.
Some terms you already learned in math are really Boolean operators
Less than < [ ] < [ ] > Equal to < [ ] = [ ] > Greater than < [ ] < [ ] >
For example: (The height of a building) < 20 meters
For any building we look at, this statement will either be true or false.

Go through what each Boolean block does (page 68)


External links

Boolean: Lesson 13: GetCoding


Book “Adventures in Coding”, Eva Holland and Chris Minnick, Wiley, 2016. Pages 50-59

Learning Standards


Computational Thinking 6-8.CT.c.2 Describe how computers store, manipulate, and transfer data types and files (e.g., integers, real numbers, Boolean Operators) in a binary system.

CSTA K-12 Computer Science Standards

CT.L2-14 Examine connections between elements of mathematics and computer science
including binary numbers, logic, sets and functions.

CPP.L2-05 Implement problem solutions using a programming language, including: looping behavior, conditional statements, logic, expressions, variables, and functions.


How a computer interprets instructions

How does a computer understand (interpret and execute) a high level programming language?



What’s the difference between a high-level computer language and a low-level language? How does a computer interpret these languages, so the program can run?  What is computer programming?

How does a computer understand a computer program  http://guyhaas.com/bfoit/itp/Programming.html

BBC Bitesize Revision: Running a program, the CPU, etc. (a 5 page step-by-step resource)  http://www.bbc.co.uk/education/guides/z2342hv/revision/1

How do you communicate with computers? Through a programming language.  Source code and language differences: Learntocodewith.me

Break down how code gets translated from the code programmers write, to the code computers read, the difference between compiled and interpreted code, and what makes “just-in-time” compilers so fast and efficient.  The Basics of Compiled Languages, Interpreted Languages, and Just-in-Time Compilers

How do computers understand programming languages? How do you “teach” a computer a language?  Explanation by Christian Benesch, software engineer and architect (among other explanations) here

How does a computer understand a computer program?  Codeconquest.com How does coding work?

What is a program? What is a programming language? Depending on the language used, and the particular implementation of the language used, the process to translate high-level language statements to actions may involve compilation and interpretation.  Introduction to Programming (Wikiversity)

Coding midterm

I. Write a sophisticated Scratch computer program, on your own, not using someone else’s code. You must first come see me with your idea, and then present quick updates, showing your progress.

Checkpoint 1 See me with your specific idea, by 5/30/17.  10 points.

Checkpoint 2: Show me the code you have each day in class. You need to be clearly explain how your code works. Your code should have many comment sections.  By the time that finals come around, your program must be complete.  If done well you can earn up to an additional 90 points.

II. Write a 4 page paper on one of the following topics.

No cover page. Upper left of the 1st page will have your name, my name/class, date and a title.  Use 12 point Arial or Times New Roman font, double spaced, 1″ margins.  You may add small diagrams and pictures, but they don’t count towards the length of your paper.  MLA Works Cited is an additional page. You must use at least four sources of information, which must be cited in MLA format.

For these topics, most Wikipedia articles are acceptable sources, however, you may not use Wikipedia for more than 2 of your sources, and you must first show me the specific , so I can make sure that it’s Ok.

A) Computers don’t actually think. So how do they know what to do with the code we write? What goes on under the hood, so to speak?  I’ve prepared many sources that you can use: How-a-computer-interprets-instructions

B) the development of computers and software: Choose 1 of these systems: the classic IBM-PC, Apple II, Apple Macintosh, Commodore Vic-20, or Commodore 64.

C) the development and programming of second generation classic video games. Choose 1 or 2 of these systems: Odyssey, Atari 2600 (aka Atari VCS), Magnavox Odyssey 2, Mattel Intellivision, Vectrex, and Colecovision. What kind of hardware was in these computers? How did they work? How were they programmed? In what language were they programmed? What was the software capable of?

D) the development and programming of third generation classic video games for neo-classic video games. Choose 1 or 2 of these systems: Sega Master System (aka the SMS), Nintendo (aka the NES or Famicon), Atari 7800.  What kind of hardware was in these computers? How did they work? How were they programmed? In what language were they programmed? What was the software capable of?

E) the development and programming of fifth generation classic video games for neo-classic video games. Choose 1 or 2 of these systems: Sega Saturn, Sony Playstation (PSX 1), Nintendo 64. What kind of hardware was in these computers? How did they work? How were they programmed? In what language were they programmed? What was the software capable of?





Cloning is a feature that allows a sprite to create a clone, or semi-duplicate, of itself
Useful in tower defense games, for example, for a wave of objects.

Clones of a sprite will be the same as the original, or parent sprite, but as a separate instance.

Clones inherit the parent’s scripts, costumes, sounds, and properties, but can then be modified.

Limit of 300 clones per project to prevent lagging/crashes.

Main tutorial https://wiki.scratch.mit.edu/wiki/Clone

The Create Clone of () block is a control block and a stack block.

It creates a clone of the sprite in the argument. It can also clone the sprite it is running in, creating clones of clones, recursively.

Tutorial https://wiki.scratch.mit.edu/wiki/Create_Clone_of_()_(block)

When I Start as a Clone (block) – a control block and a Hat block.

It activates in a clone when it gets created.

It is the only Hat block in the Control palette; all the others are in Events, Motor, or PicoBoard.

Tutorial https://wiki.scratch.mit.edu/wiki/When_I_Start_as_a_Clone

Delete This Clone

Tutorial https://wiki.scratch.mit.edu/wiki/Delete_This_Clone

Duplicating Sprites: This is NOT the same as cloning


Scratch Resources



The Pen is a feature in Scratch that allows a Sprite to draw shapes, plot colored pixels, and so forth on the screen with the Pen Blocks. Lines, dots, rectangles, and circles are the easiest shapes to draw, but with enough scripting, any shape can be created.


A graphic effect is an effect that can be used on a sprite or the Stage, changing their look in some way. These blocks can be found under the Looks section. No effect, color, fisheye, whirl, pixelate, brightness, ghost, mosaic




Plot a line ( y=mx +b) Hit ‘space’ to plot a line and the c key to clear the old lines.

Speed=Distance/Time: Doesn’t actually calculate numerical answers. Instead, it changes the size of the S, D and T graphical icons according to their value.

Make your own line graph (primitive)

Drawing fractals

Advanced projects using physics and math:
-Use Trigonometric principles to determine Vectors for X and Y Directions for Sprite(Object) Movement.
-Simulate Gravity Physics.
-Use Conditional Statements and While Loops (Repeat Until) to determine action within Game.
– Use Variables to store, calculate, and direct movement within Game/Simulation.

CoderDojo: AthenryMultiple advance Scratch topics


Building a 3D wireframe


Galaga classic video game


Building a platforming game in Scratch


MIT’s Scratch Part 4: Twenty Webs Sites To Support Scratch And The Itch For Transforming Education


Teach-ict – 5 projects (7 hours+) for fully functional games.

Teach-ict.com programming/scratch/scratch_home.htm

Mathematics problems




Recommended books

Scratch Programming for Teens PDF book free online

Adventures in Coding, Eva Holland and Chris Minnick 

Learn to Program with Scratch: A Visual Introduction to Programming with Games, Art, Science, and Math. By Majed Marji 

Scratch Programming Playground: Learn to Program by Making Cool Games, by Al Sweigart

Scratch 2.0 Sams Teach Yourself in 24 Hours, by Timothy L. Warner