How to Use Scratch to Make a Story

Ryan Barone
March 01, 2024

Who wouldn't want to make and tell a story in Scratch? Creators can give players choices that change the paths the story takes and even alter the ending! Today we will dive into how to create a conversation between characters, switch backdrops, and hide and show characters while creating a story plot.

To make a game on Scratch and to create an interactive story, it's crucial to come up with a branching narrative: at set intervals in the story, there will be choices the player picks from that decide which branching path the player goes down.

For example, the game could ask the player whether they want to go to a beach or a ski resort. The answer the player chooses will change the location of the story and the events that take place there. 

Because the answer can impact the entire game, the questions should be asked before one starts coding in Scratch in order to plan the different paths the story will take.

Plot and Plan

A story template helps plot the story theme and other details like characters, locations, and more. 

Specifically, each story step should be outlined, moving the player from game start to choice 1, and then options A and B from that choice, and then choice 2A and 2B, and so on. 

Set the Scene

Once planning has been completed, it's time to start creating, starting with a scene (which is any part of a story that takes place in one specific location). 

For this example, let's say there are three scenes:  

  1. Bedroom (where the story begins)
  2. Beach (option A)
  3. Ski Resort (option B)

To start with the first scene, which takes place in the bedroom, we need a Backdrop and the sprites. 

  1. Add the Sprites and Backdrops needed for the first scene.
  2. Add two button Sprites that the player will able to click for choices.
  3. Add text onto the buttons in the Costumes tab of each Sprite.

Here is an example:

choose a scene scratch.jpeg

Broadcasting Messages

Now, to get from one scene to another, we will have to broadcast a message in Scratch. (A broadcast sends a message, or player choice, from one Sprite to another.)

A broadcast can tell all of the Sprites and Backdrops "the player was asked question A" or "the player answered question A with option B". This way, the Sprites can be told to act only if a question is answered a specific way.

  1. Select the Option A button (i.e. "Beach" choice).
  2. Add a when flag is clicked block and attach a go to front layer block, a go to x: 0, y: 60 block, and a hide block.
  3. Add a when I receive message1 block from the Events panel and click the drop-down to create a new message named question 1 asked.
  4. Attach a show block to this.

add a show block.png

  1. Add a when this sprite clicked block and attach a broadcast message 1 block.
  2. Add a new message named question 1 answered A and then attach a hide block to it.
  3. Add another when I receive message1 block and add a new message named question 1 answered B. Then, attach a hide block.
  4. Copy the code onto Option B button and change when this sprite clicked broadcast to question 1 answered B.
  5. Change the second when I receive message to question 1 answered A.

scratch choices 2.jpeg

When  Beach (Option A) is clicked, it will broadcast a message to the game, saying "the player chose me!" After a choice has been made, both buttons will hide themselves.

Now, if following along and when this code is played, nothing happens, that's because Question 1 ("Where do you want to go?") hasn't been asked yet, so the player hasn't received the message they need to show up.

Learn more about how to make an "eat the apple" snake game in Scratch

Question and Answer

So, to get the buttons working, we need to ask the first question. 

  1. Place the Sprites and add dialogue and sounds to make the first scene.
  2. For the Sprite that asks Question 1 (i.e., "Where do you want to go?"), attach a broadcast message1 and pick question 1 asked.

ask a question scratch.png

Now that Question 1 has been asked and broadcasts a message, the buttons will show up! When a button is clicked, it will broadcast its own message so the game knows which Option (A or B) has been chosen.

Adding a Scene Change

A scene change happens when the characters go to a new location (scene). Since there are two Options, the game will have two scene changes.

  1. To the Sprite(s), add when I receive question 1 answered A and attach some unique dialogue for both A and B (i.e., "I want to go to the Beach!" or "Let's go to the the Ski Resort!").
  2. For the character who changes the scene (i.e. the Fairy Sprite after saying, "Let's go!"), attach a broadcast block with a new message named scene change A.
  3. Duplicate the new blocks for Option B with a new message named scene change B.

scene change.png

Switching Backdrops

  1. Add a when flag is clicked with a switch backdrop to Backdrop 1 block so that every new game starts on the same scene.
  2. Add a when I receive scene change A block.
  3. Add a switch backdrop to Backdrop 2 block, as well as any optional effects and sounds if desired.
  4. Duplicate this for scene change B, switching to Backdrop 3 this time. 

switching backdrops.png

TIP! Adding a ghost effect will turn the image invisible depending on what the variable is set to. A 0 will result in no change, while a 100 will the the image fully invisible! Using the repeat block can create a gradual change from normal to invisible.

When the scene changes, either from Backdrop 1 to 2 or Backdrop 1 to 3, the character should react to being transported to a new location. Then, the player can be asked a new question that lets them choose between 2 endings for the scene, and so on. 

Once all the choices and buttons have been coded, all that's left is to create endings. Yes, plural! Meaning, if the story has four final choices (say, two for Scene A and two for Scene B), there can be four unique endings. 

We won't get into the coding piece here, but here are some examples:

  • Add an ending conversation between the characters.
  • Create an ending screen
  • Show the character being sent back to their starting location, making the game loop back to the beginning to be played again

Game on!

To recap, this is one of the easiest Scratch games to make, while still challenging kids dig into their imaginations while using code and art. Creating a branching narrative story game gives the player the power to change a story and choose the ending. Then, one can use when sprite clicked with broadcast blocks and messages to create clickable options. 

When a player is given multiple options in a story, it creates a branching narrative—giving lots of opportunity for replaying the game!

Want to learn more? Check out the different coding websites like Scratch, or any of our many Scratch camps and Scratch coding classes

Meet iD Tech!

Sign up for our emails to learn more about why iD Tech is #1 in STEM education! Be the first to hear about new courses, locations, programs, and partnerships–plus receive exclusive promotions! Online camps, Roblox coding classes, coding summer courses, and more. 

By signing up you agree to our Privacy Policy
Subscribe & Save!

Meet iD Tech!

Sign up for our emails to learn more about why iD Tech is #1 in STEM education! Be the first to hear about new courses, locations, programs, and partnerships–plus receive exclusive promotions! Online camps, Roblox coding classes, coding summer courses, and more. 

By signing up you agree to our Privacy Policy

Meet iD Tech!

Sign up for our emails to learn more about why iD Tech is #1 in STEM education! Be the first to hear about new courses, locations, programs, and partnerships–plus receive exclusive promotions! Online camps, Roblox coding classes, coding summer courses, and more. 

By signing up you agree to our Privacy Policy
Subscribe & Save!

Meet iD Tech!

Sign up for our emails to learn more about why iD Tech is #1 in STEM education! Be the first to hear about new courses, locations, programs, and partnerships–plus receive exclusive promotions! Online camps, Roblox coding classes, coding summer courses, and more. 

By signing up you agree to our Privacy Policy