Scratch Mix and Match Challenge #4

Scratch Mix and Match Challenge #4

Middle - Grade 12

Art & Design, Computer Fundamentals, Digital Storytelling, Game Design
Video Tutorial
Mary McDonald

Mary McDonald

About the author

Mary is an educator, writer and media artist who loves to collaborate. She creates poetry films and Augmented Reality art installations. Mary gets really excited about participatory media digital arts projects and believes in the potential for creative technologies to inspire individuals and connect communities. Mary’s next adventures include creating sound compositions of letters from WWI. Mary has a B. Ed, specializing in Special Education and Language Literacy and is currently finishing off her Master’s of Educational Technology degree through UBC. She has taught in Canada and at international schools in Africa and in Asia. Mary loves traveling to meet new people, learn about different ways of being, and experiencing new landscapes.


The last Scratch Mix and Match Challenge is here! With the code from these cards, you can make a Choose Your Own Adventure style game. Scratch is a great tool to help you make video games and digital stories that you can share with your family and friends. If you are interested in developing your skills as a programmer, Scratch can help you to learn how to develop games and consider what makes a game fun to play. In each Mix and Match challenge, you are asked to use at least two of the three challenge code cards to make your game. Think of the kinds of games you like to play as you create your game. You can revisit the other Mix and Match challenges to review how to build your own game. You can start with the Mix and Match Challenge #1 here

The colour coding used on the code blocks will help you find the code you need

The code block menus in Scratch.

Discover the three cards for this challenge

Play the Game

Instructions: Critter has wandered into this fantasyland from the All Together Now game where he was traveling around northern Canada looking for friends. Use the arrow keys to move Critter until the wizard grants him the ability to fly with a magic broom and wield a magic wand.

Thanks to Emma Rutherford for writing the fairy’s magic spell.

Thanks so much to Chris Haugen for his track, Hulu Ukulele

Follow Mouse Pointer 

Thanks so much to Chris Haugen for sharing their track, Campfire Song

When creating a game, one of the first things to think about is how you are going to make your sprite move around. You can press keys to make your sprite move and you can have the sprite follow the mouse cursor. There are many different ways to code a sprite to follow the mouse cursor and each way will achieve a different effect. Experiment with the different ways to find the one that you like the best for your game or story. 

  1. Start your code with a yellow Events block. The block, “when green flag clicked” will run this code and make this action happen right at the beginning of the game.
  2. “Go to mouse pointer” block will make this sprite go immediately to the mouse pointer.
Go to mouse pointer block.
  1. The orange Control “forever” block tells the computer to keep running the code that is wrapped inside it. 
Scratch code blocks.
  1. I want the wand to be visible and to stay in the front layer so I added a “go to front layer” purple Looks block. 
  2. The wand will continue to point in the direction of the mouse pointer so that I can aim the wand where I want with the blue Motion, “point towards mouse pointer” block.
  3. The wand sprite will continue to glide to the mouse pointer, no matter where I move it on the stage and in the game. Changing the number in the value bubble will change how long it takes for the wand to get to the mouse pointer. Changing the number to a smaller number will make this wand sprite move faster to the mouse pointer. Changing it to a bigger number will make the sprite take more seconds to move to the mouse pointer and so the sprite will move more slowly.
Glide 0.2 second block.
  1. There are many different ways to code a sprite to move with the mouse pointer. You can experiment with the codes shown on the Mix and Match Follow Mouse Pointer cards. Here is a bonus way to try. 
Scratch code blocks.
  1. The starter project, Choose your own Adventure with Critter game has different ways set up for the sprites to follow the mouse pointer. Download the game to experiment and test these and remix it to create your own game.

Chatbot Giving Directions

In many games, there are characters who appear and give instructions or challenge the players during the game. To learn more about the different kinds of characters in game narratives, visit Courtney’s tutorial here. With the code shown on the Chatbot Giving Directions Mix and Match card, you can make a character give instructions to the player. You can also bring the player into the game to make the game more immersive. With this code, the player can give their input and choices to affect what action happens in the game. 

Thanks so much to The Mini Vandals featuring Mamadou for sharing their track, High Life

Chatbot Giving Directions Scratch card.
  1. Choose a yellow Events block to start your code algorithm. These Events blocks at the top of the Events category have a “hat shape” which means they begin the code sequence and no other blocks can be attached above these blocks.
  2. The light blue Sensing blocks bring input from the game and report it to the computer. The “ask (What is your name?) and wait” block will bring up an input bar on the stage.  This code block is also used in the Ask Your Name Mix and Match cards. We use the same code block to give the player choices as we continue to build the code algorithm.
Scratch code highlighted.
Critter course game.
  1. To use the player’s input, we need to make a Variable. Variables are information that will be different for each game or change during the game. Each time the game is played, we want the new player’s character name to be brought into the game, and so this changing and variable information will be stored and reported by the computer as a Variable
Make a variable.
  1. For this first input step, we want the player to put in the name of their character. We will make a Variable that will record and report this information. Let’s call this Variable “Name”. 
Option to change your variable name.
  1. To set the answer given by the player as the Variable, we will use the “set (your variable) to” block and the light blue Sensing block, “answer”. The light blue Sensing “answer” block will record the information typed into the input bar by the player and attach that information to the Variable.
Highlighted code.
  1. The purple Looks “say (something) for (2) seconds” block will show the text that the character says on the stage and in the game, just like how characters talk in a comic strip. To make the character say the words and bring in the player’s input answer, we can use a green Operators “join (something) (something) for (2) seconds” block.
Join apple and banana block in Scratch.
The Join block connected with other blocks.

Don’t forget to type in the space after the text in the first bubble so that the words will be separated when they show in the game or story. 

  1. You can drag the Variable block right into the purple Looks “say (something) for (2) seconds” block. This will make the character sprite say the word “Noble” and the character name that the player typed into the input answer box. 
Code blocks in Scratch.
  1. The next blocks set up the choice for the player. 
Code in Scratch that allows players to make a choice.
  1. Let’s pull these blocks apart to get a good look at all of the pieces used in this part of the algorithm.
Various code blocks in Scratch.
  1. The light blue Sensing “ask (something) and wait” block will bring up the input bar for the player to provide some information or to make a choice. You can type whatever words you want (and in whatever language you want) into the text bubble. 
Ask "Do you accept the challenge?" and wait block.
  1. The orange Control “if…then else” block will make one of two things happen in the game. If something is happening in the game and the condition is true,  then the action in the first opening of the “if…then else” block will happen. If that condition is not true, if the specific event described is not happening then something “else” will happen. 
Various code blocks in Scratch.
  1. If the player answers yes and types yes into the input bar, then the action in the first opening of the orange Control  “if..then else” block will happen. If the player types in “yes” then the wizard will say, “Catch the crystals to reveal your mission”.
If then block in Scratch.
If then block in Scratch.
  1. If the player types “no” into the input bar, then something else will happen and  the wizard will say, “Fare well on your travels (Name of character answer) for (3) seconds” instead. Using the green Operators “join (something) (something) for (3) seconds” block lets us have the wizard say something as well as say the information that is held in the deep orange Variable “Name” . The information held by the Variable is the character’s name that the player typed into the first input bar. 
If then code block added to code.
Answering a question in Scratch.
Farewell dialogue option in the Critter game.

The code algorithm for the Chatbot Giving Directions Mix and Match card seems complicated and has a lot of pieces involved. Don’t be scared to use this code algorithm. When you pull all the pieces apart, you can see that it’s not that difficult to put it back together if you build it one block at a time. Use the colour coding of the blocks to help you find the blocks that you need. Creating an interactive, immersive, Choose your own Adventure type game can be a lot of fun! 

Broadcast Message

Thanks so much to the Great North Sound Society for sharing their track, Corndogs in Santa Monica

The yellow Events blocks for “broadcast message” are some of my favourite code blocks in Scratch because you can use them to directly control the actions and timing of sprites in your game or story. You may have noticed that I’ve used these code blocks in almost all of the games I’ve created for the Mix and Match challenges. Watch the video and follow along with the tutorial below to see how to use these powerful blocks. (Remember that the code shown on the Mix and Match cards can be adapted to fit your game or story.)

Broadcast Message scratch card.
  1. At the beginning of the Choose your own Adventure with Critter game, Critter moves when the player presses the arrow keys. However, after meeting the Wizard character sprite who gives Critter a magic wand and magic broom, Critter flies and  moves by following the mouse pointer. Let’s look at how to set up this change of game action using the broadcast message blocks.
A stack of code in Scratch.
  1. This code begins with the yellow Events block “When I receive (message)”.  Critter has to first receive the message “broom and fairy” for the rest of the code to run and for Critter to begin “flying” by moving by following the mouse pointer.
Various code blocks in Scratch.
  1. When this code begins running, and when the computer and Critter receive this message, Critter is commanded to “go to (mouse-pointer)” with this blue Motion block.
  2. Then Critter broadcasts the next message “broadcast (how to fly off on the broom)” to make the fairy appear, and the rest of this code algorithm which will make Critter follow the mouse-pointer for Critter will run. 
A stack of code blocks in Scratch.
  1. Critter receives the message,”when I receive (broom and fairy)” after the wizard appears. Let’s look at the code for the wizard sprite to look for this message broadcast. 
A full block of code in Scratch.
  1. You can see that the wizard broadcasts the message to bring in the fairy character and the broom after asking Critter if he will accept the challenge. We can see the yellow Events code block, “broadcast (broom and fairy)” at the end of this code algorithm.
Broadcast message block in Scratch.
  1. Pressing on the drop-down menu in the middle of the broadcast “(message)” block shows all the messages that have been created for this game. Follow the steps below to learn how to broadcast a message and how to have a sprite receive and activate a message. 
Drop down menu for the broadcast block.

3 Steps to Creating a Message 

  1. Select the “broadcast (message)” block from the yellow Events blocks. Open the drop-down menu in the middle of the block and choose “New message”. 
Broadcast message drop down menu.
  1. Type a name for your message into the pop-up dialogue box.
New message name in Scratch.
  1. Now you will see the name of the message you have created in the “broadcast message” block. It’s that simple! 
The final outcome of the Broadcast Message blocks.

3 Steps for a Sprite to Activate the Message 

  1. Select the sprite that you want to receive the message. In the code area for that sprite, bring in a “When I receive (message)” block. Open the drop-down menu and select the message for that sprite. Critter broadcast the message “make the wizard appear” so we will select that one. 
When I receive block drop down menu.
  1. Now you will see the message for that sprite at the beginning of this code algorithm.
When I receive block in Scratch.
  1. Add the code that you want that sprite to make happen, to run. It’s that simple and so powerful!
Final code blocks for the broadcast message card.

The broadcast message blocks allow you to control the timing of actions in your game. Messages are simple to create and are very powerful to use in your game or story. 


The code shown on these three Mix and Match cards can be used together to help you make your own Choose Your Own Adventure type game. Each of the code cards can also be used in many different in your games or stories. I can’t wait to see what you create!

We want to see the awesome things you’re creating! Take a photo or video and share your work with us by emailing or tagging @pinnguaq on Facebook, Twitter, or Instagram. Don’t forget to include the hashtag #LearnWithPinnguaq! You can also upload your project to the Pinnguaq Studio. For more fun activities, visit

You might also like