Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

1. Présentation de Graffitis


Hi, and welcome to Day 5 of Scratch Art! Today you will create an interactive graffiti game while learning about an important computer science concept called conditionals.

Conditionals are a way for computers to make decisions. In most computer languages, conditionals start with the word “if.” “If” statements can be read: “If something is true, then do this action.” Like, “If you are tired, then take a nap,” or “If the paint brushes are dirty, then wash them.”

Conditionals are used all the time in computer science. They are even used in programs that help historians restore art.

Many historical pieces of art have been damaged over the years. Exposure to direct sunlight discolors and fades paintings over time. Dust and dirt accumulates on paintings over decades, even centuries, dulling the artist’s original colors. Art restoration attempts to return these damaged works of art to their original beauty.

Art restoration is a painstaking process. Computer scientists can help make it easier, though! Using calculations based on old photographs of a piece of art, computer scientists generate digital images showing how it looked originally.

But historians may not want to change the original work to restore it because doing so would also change the artwork forever! Instead, museums create special visual displays that make each tiny section of a damaged painting into a pixel.

A computer program compares each pixel to the computer-generated version of the original.

If the colors of two pixels do not match, then projections are directed at that part of the artwork, creating an optical illusion that makes the human eye see the painting’s original color. With the help of computer science and if/then statements, everyone can enjoy viewing artwork the way the artist originally intended it, without changing the masterpiece itself! You can program some conditionals of your own in Scratch using an “if/then” block. Check out this example of a Scratch project that uses an "if/then" statement.

The "if/then" block here can be read as: “If the mouse pointer is touching the elephant sprite, then change the sprite’s color effect by 10.”

In today’s project, you will program an interactive graffiti game using an “if/then” block. Users will be able to create their own graffiti masterpieces in Scratch using your project. When the user clicks and drags the mouse, spray paint appears on the wall.

This video will introduce remixing the starter project.

To start your graffiti project, click the starter project link next to this video. Click remix, and sign in to Scratch. The starter project contains a brick wall stage and a spray paint sprite. There is no code in the starter project yet.

Now it’s your turn: Click the Starter Project, remix it, and sign in.

Suivant arrow_forward
  1. Remixe le projet de démarrage Graffitis.
  2. Connecte-toi à Scratch.