How to Make a Game with Branching RPG Dialogue | Scratch Tutorial

Alphabets Sounds Video

share us on:

In this lesson, Zinnia teaches how to create an engaging game in Scratch that features branching RPG dialogue, allowing characters to respond differently based on player choices. By utilizing the “Ask” and “Answer” blocks, along with control structures like “if-then” statements and variables to track interactions, players can create dynamic conversations that enhance the gaming experience. The lesson encourages creativity and experimentation, inviting participants to customize their games further.

How to Make a Game with Branching RPG Dialogue in Scratch

Hey everyone, it’s Zinnia here! Today, I’m excited to show you how to create a fun game using Scratch, where characters can have conversations that change based on what the player says. This is called branching dialogue, and it makes your game more interesting because characters can respond differently depending on the player’s choices. Let’s dive into how you can do this!

Getting Started with Your Game

First, you’ll need a basic setup for your game. Imagine a virtual town where you can move a main character around using the arrow keys. You can also click buttons to explore different locations. In this town, there’s a character you can talk to. Instead of just saying “hello” every time, let’s make them ask questions and respond to your answers!

Using the “Ask” and “Answer” Blocks

In Scratch, there’s a cool feature in the sensing category called the “Ask” block. This block lets your character ask a question, and it opens a box for the player to type their answer. For example, if the character asks, “Do you like fish?” the player can type “yes” or “no” as their answer.

Making Characters Respond to Answers

To make your character respond based on the player’s answer, use an “if-then” block from the control category. This block checks the player’s answer. If the answer is “yes,” the character might try to sell fish. If the answer is “no,” the character could express disappointment. This makes the game more interactive and fun!

Changing Dialogue After First Interaction

Right now, the character asks the same question every time you click on them. To make the conversation more dynamic, create a variable called “Times Talked to Character.” This variable keeps track of how many times you’ve talked to the character. After each interaction, increase this variable by one. You can then use it to change what the character says after the first conversation.

Resetting and Storing Player Answers

When you start the game by clicking the green flag, reset the “Times Talked to Character” variable to zero. If you want the character to remember the player’s answer from before, create another variable called “Fish Answer.” After the player answers the question, store their response in this variable. You can use this information later to customize what the character says based on the player’s previous answers.

Have Fun Creating!

I hope you enjoy making your own branching dialogue game in Scratch! Feel free to add your own creative touches and new features. If you have any cool ideas or need more help, let me know. I might even make a part two to explore more features. Have fun, and happy scratching!

  1. What aspects of creating a branching dialogue game in Scratch did you find most intriguing, and why?
  2. How do you think the use of branching dialogue can enhance the storytelling experience in a game?
  3. Reflect on a game you have played that used branching dialogue. How did it impact your engagement with the game?
  4. What challenges do you anticipate when implementing the “Ask” and “Answer” blocks in your own Scratch project?
  5. How might keeping track of player interactions with variables like “Times Talked to Character” influence the player’s experience?
  6. In what ways could storing player answers in variables be used to create more personalized gameplay experiences?
  7. What creative ideas do you have for expanding on the basic branching dialogue system described in the article?
  8. How do you plan to incorporate feedback and new ideas into your game development process after reading this article?
  1. Create Your Virtual Town

    Start by designing a simple virtual town in Scratch. Use the backdrop and sprite tools to create different locations and a main character. Move your character around using the arrow keys. This will be the setting for your branching dialogue game.

  2. Experiment with the “Ask” Block

    Use the “Ask” block to have your character ask questions to the player. Try asking different questions and see how the “Answer” block captures the player’s response. Practice typing different answers to see how the game reacts.

  3. Build Interactive Dialogue

    Use the “if-then” block to make your character respond differently based on the player’s answers. Write a script where the character reacts positively to a “yes” and negatively to a “no.” Test your script to ensure it works correctly.

  4. Track Conversations with Variables

    Create a variable called “Times Talked to Character” to keep track of how many times you’ve interacted with the character. Use this variable to change the dialogue after the first interaction. Experiment with different responses for each interaction.

  5. Store and Use Player Responses

    Create a variable called “Fish Answer” to store the player’s response to a specific question. Use this stored answer to influence future dialogues. For example, if the player said “yes” to liking fish, have the character remember this in later conversations.

Sure! Here’s a sanitized version of the YouTube transcript:

Hey everyone, it’s Zinnia here! Today, I wanted to show you how to create RPG dialogue in Scratch, specifically how to make a game with branching conversations. This way, a character doesn’t just say one thing every time you click on them; instead, they can respond to what the player says and provide different responses based on the game’s events. I’ll demonstrate this with an example project, but feel free to customize it with your own characters and dialogue.

Let’s get started! For the base of this game, I’m going to use the virtual town I created in a previous video. If you’re interested in how I put together that code, you can check out that video. Essentially, you have a main character that you can move around with the arrow keys, and you can click buttons to navigate between locations. There’s also a character who will say something when you click on them, but instead of just having them say “hello” every time, let’s make them respond to the player’s input.

The best way to do this in Scratch is by using the sensing category. There’s a block that says “Ask,” and another block that says “Answer.” When you drag out the Ask block and click on it, it prompts the character to ask a question and opens a box for the player to type in their answer. For example, if I type in “Zia” and hit return, the round answer block will hold that response.

To have the character ask a question, you can attach the Ask block and input your desired question. I’ll have the character ask, “Do you like fish?” Now, when you click on the character, they will first say “Hello” and then ask about fish. However, right now, the character isn’t doing anything with that answer.

To make the character respond based on the player’s answer, we can use an “if-then” block from the control category. We’ll check if the player’s answer is “yes” or “no.” If the answer is “yes,” the character can try to sell fish, and if it’s “no,” they can express disappointment.

Let’s test that out! When I click on the character, they ask, “Do you like fish?” If I say “yes,” they will try to sell fish to me. If I say “no,” they will express sadness.

Now, every time you click on the character, they ask the same question repeatedly. If you want the character to say something different after the first interaction, you can create a variable to track how many times you’ve talked to them.

Let’s create a variable called “Times Talked to Character.” After talking to the character, we can increase this variable by one. Now, when we click on the character, we can check if “Times Talked to Character” equals zero to determine which dialogue to display. If it’s not zero, we can have the character greet the player differently.

To reset the variable when the green flag is clicked, we can set “Times Talked to Character” back to zero.

Lastly, if you want the character to remember the player’s answer from the previous interaction, you can store that answer in a variable. I’ll create a variable called “Fish Answer.” After the player answers the question, we can set “Fish Answer” to the player’s response.

Now, we can use this variable later in the project to customize the character’s dialogue based on the player’s previous answer.

I hope you have fun creating your project! If you have any ideas for features to add, let me know in the comments. I could always make a part two. See you next time, and happy scratching!

This version removes any informal language and focuses on the instructional content.

GameA program or app that people play for entertainment, often involving rules and challenges. – Example sentence: We created a simple computer game in class where you have to catch falling apples.

ScratchA visual programming language that lets you create stories, games, and animations by snapping blocks together. – Example sentence: In Scratch, I made a cat dance across the screen by connecting different code blocks.

CharacterA person, animal, or object in a game or story that can be controlled or interacted with. – Example sentence: My favorite character in the game is a robot that can jump really high.

DialogueText or speech in a game that shows what characters are saying to each other. – Example sentence: I added dialogue to my game so the characters could talk to each other during the adventure.

AnswerA response to a question or problem in a program or game. – Example sentence: The game asks you a math question, and you have to type the correct answer to move to the next level.

QuestionA sentence or phrase in a game that asks for information or tests knowledge. – Example sentence: Each level of the game starts with a question that you need to solve to continue.

PlayerA person who interacts with and controls characters or elements in a game. – Example sentence: As the player, you can choose different paths for your character to explore in the game.

VariableA storage location in a program that holds data which can change during the execution of the program. – Example sentence: We used a variable to keep track of the player’s score in the game.

InteractiveAllowing a user to engage with a program or game by making choices or controlling actions. – Example sentence: The interactive story lets you decide what happens next by clicking on different options.

FunEnjoyable and entertaining, often used to describe games or activities that are amusing. – Example sentence: Coding our own video game was so much fun because we got to be creative and see our ideas come to life.

All Video Lessons

Login your account

Please login your account to get started.

Don't have an account?

Register your account

Please sign up your account to get started.

Already have an account?