Tag Archives: Scratch Programming

Make Your Own Games using Scratch

Scratch is a computer programming language that is designed for use by children to learn programming, but that is also serving as a paradigm for STEM programming more broadly, and I suspect, for IOT programming of the future. Programs are written in scratch by assembling shapes that represent programming structures or objects.

For example, look at the code block to the right. This is an object that is called when the user clicks on the green flag button on the user interface. That green flag is how one starts a program in Scratch. This is hooked, literally, to a “forever” lop. Within the forever loop, execution (of that object) is delayed for a fifth of a second, then an “If” statement is executed. If the object linked to this object (such as a sprite that might be able to move around on the screen) has come into contact with something green, a chomp sound is made.

The Scratch interface is normally accessed on a web page, and in that context, every single Scratch programmer (that uses the basic interface) has access to every bit of code developed and saved by every other programmer. Or, you can run it on your own computer.

You will see scratch like coding in Lego projects, in association with various robot kits, and I suspect over time, with Internet of Things objects. The coding is so straight forward that even Mikey can do it.

The book Make Your Own Scratch Games! by Anna Anthropy, produced by No Starch Press, brings an elementary school or middle school age kid, or an adult who just wants to screw around, through the process of developing three significant game projects and countless elements that users can use for a number, approaching infinity, of different games.

As is usual for No Starch books, the source code is available, but more importantly, among the on line resources are certain graphics and sound files and such used in the game making.

This is a great book for STEM oriented kids, and Scratch is a great Age of Covid activity.

Anna Anthropy is a video game creator and game historian, and author of Rise of the Videogame Zinesters: How Freaks, Normals, Amateurs, Artists, Dreamers, Drop-outs, Queers, Housewives, and People Like You Are Taking Back an Art Form, a guide to game design that encourages aspiring developers from all backgrounds to create games and contribute their unique voice to the video game industry. Her most recent book, ZZT, explores a shareware game from the โ€™90s and its lasting impact on developers everywhere.

Scratch Programming For Kids, By The Cards

Last October I reviewed Scratch Programming Playground, by Al Sweigart.

Screen Shot 2017-01-25 at 2.38.32 PMYou will recall that Scratch is a programming language that uses drag and drop elements to construct a program.

Individual objecgts, including “sprites” that can move around on the screen, as well as static graphic elements, sounds, etc. get their own code, and this code can be set up to start under various conditions, such as when something touches something, or the user hits a certain key, etc.

This allows for the development of very simple but fun programs, and vey complicated ones as well.

Scratch is normally implemented on an MIT web page, though it can be installed on a computer for local use. Increasingly, specialized versions of Scratch are being used for robotics. I have predicted that Scratch will for the basis of the programming language that will give normal humans access to the Internet of Things.

The image on the right is a segment of code for an implementation of Pac-Man on Scratch.

This programming code applies to a sprite that looks like the yellow Pac-Man thingie. The entire block runs when a certain (“start”) signal is received, causing the sprite to point in a certain direction and go to a certain location, to start the game.

The next block is repeated “forever” (not really, but until the program is terminated or the loop exited on purpose).

Then the various “if” blocks determine what happens. If Pac-Man’s red part (a little dot out in front of itself) touches anything black, which basically means clear runway to move along, then it moves forward. Then, a series of if blocks pick up signals form the game player’s arrow keys, causing Pac-Man to change direction. The controls basic movement of the Pac-Man sprite around the board.

Screen Shot 2017-01-25 at 2.45.35 PMElsewhere in the code, the Pac-Man eating monsters are controlled, and one of those uses the code shown here on the right. Once the game starts, this monster (“Pinky”) moves to a starting point, then for the entire game glides in the direction of Pac-Man until it is killed.

That gives you an idea. For more of that, and information about the book I recommend you use to learn Scratch, I mean, give to your kid to learn scratch, go here.

And now I have something else for you.

Scratch Coding Cards: Creative Coding Activities for Kids is a collection of cards that you, er, your kids, can use to learn Scratch programming. This is rated for kids 8 or above, but I think they can be easily used by younger kids, with a modest amount of adult help.

The cards come in sets that go together meaningfully, and they are color coded. For example, there is a set of “Let’s Dance Cards.” This includes coding examples addressing sequencing, music, taking turns, leaving a trail, etc.

The front of each card gives a visual indication of what the result is going to look like, and the back has the code. This is typically further divided (on the back) in to three parts: Get ready (what you need to have, know, etc.), the code itself (like the code blocks shown above, but generally very little bits at a time), and a “try it” prompt or a helpful tip of some kind.

There are sections or racing, hide and seek, story telling, and other projects.

At first I was wondering why they don’t just make this into a book, but then I remembered that kids like to play with things that are explicitly not books. Also, the cards to not have to stay together or in order. Indeed, you can take cards from different project groups and put them together to create new programming projects, to some extent.

Scratch Coding Cards: Creative Coding Activities for Kids is a fun addition to one’s set of programming tools. If you gave a kid a book on Scratch for one holiday or birthday, this may be a good followup next time around a few months later.