How to Make an Undertale Game in Scratch – A Tutorial for Kids

It is quite easy to get a beginner kid interested in programming: you need to take a simple visual language and find a detailed lesson. This is exactly what we offer and want to tell you how to write Undertale in Scratch.

“Undertale” is a computer role-playing game that captivates children and teenagers thanks to its plot: the player's task is to escape from a virtual dungeon. You have to endure a series of battles with hostile characters: they can be punished or spared. The ending depends on the player's choice, which makes it exciting even if you play it more than once.

Let's make an Undertale clone together in the Scratch language, using the visual code writing environment of the same name.

The lesson was prepared by the programming school for children Pixel. We offer simple and consistent instructions: we will start with the basics and move on to more complex issues in order to step by step analyze the creation of your own game from scratch.

Making an Undertale Game in Scratch: A Tutorial for Beginners

First we need to go to official website of the program and log in to your account or create a new account. It's free, and you can work with the environment's tools online.

If the first step is done, let's start creating our own clone of the game “Undertale”.

1. Create the first location and add objects to it

Undertale is primarily a walker, so we have a lot of locations to make. Let's start with the main one and create its main parts. Let's:

  1. Let's create a basic background. To do this, select the fill and set the color to black.

  2. Let's make some improvised purple ruins, like in the original game.

  3. Let's draw the road using a darker purple color with a stroke.

What should happen is shown in the screenshot.

Now we need to remove the lines inside the road. Take a rectangle of the desired color and turn off the outline.

Image looks like text, screenshot, monitor Auto generated description

Image looks like text, screenshot, monitor Auto generated description

We also need a river and a bridge. You can add them using rectangles: blue and brown. To make the bridge realistic, we will use horizontal stripes of a darker color. It should look like the screenshot.

Image looks like text, screenshot, monitor Auto generated description

Automatically generated description

2. Create additional locations

We need to make two more backgrounds. They will need to depict the ones shown in the screenshots.

Image looks like text, screenshot, monitor Auto generated description

Automatically generated description

So, we have prepared three locations. We need an additional background: we will move to the corresponding location if we meet a monster. We will make and program it soon, but first we will perform other actions.

3. Draw a new background for interaction with the monster

Let's repeat the partially familiar steps:

  1. Let's fill the working field with black color.

  2. Let's create a transparent rectangle with a white outline and place it at the bottom of the screen.

  3. Let's make a zone with green frames and cells, place it on top. This area is intended for the monster.

It should look like the screenshot.

Image looks like text, screenshot, monitor Auto generated description

Automatically generated description

An important detail: the cells must be drawn to the end.

4. Let's start programming RPG in Scratch language

First, let's create the main character. If we go by the plot of Undertale, then we need a child. The main steps are:

  1. Let's go to the sprite library.

  2. We choose the desired option. Let it be the character Avery.

  3. We reduce the standard size in the corresponding tab and set the value to 40.

Image looks like text, screenshot, monitor Auto generated description

Automatically generated description

We continue coding and use the following commands:

  1. When the flag is pressed, appear.

  2. Set HP to 5.

  3. Switch to the first background.

  4. Go to coordinates -154 and -134, that is, to the beginning of the track.

  5. Repeat always.

The repeat cycle will contain four conditions. Here they are:

  1. Up arrow pressed, change Y to 10.

  2. Right arrow pressed, change X to 10.

  3. Down arrow pressed, change Y to -10.

  4. Left arrow pressed, change X to -10.

This is what the block code should look like:

Image looks like text, screenshot, internal, monitor Auto generated description

Automatically generated description

4.1. Create simulated steps

We chose Avery for a reason: there are ready-made costumes for this character. Before the created cycle, you need to insert the block “change costume to costume a”. Next, you will need to set commands for costumes b, c and d. Between them, pauses of 0.5 seconds are required.

This is what our code will look like:

Image looks like text, screenshot, computer, internal Auto generated description

Automatically generated description

It is necessary to take a new block out of the general cycle and insert it into another one with a repetition condition.

Image looks like text, screenshot, internal, computer Automatically generated description

Automatically generated description

Now let's go back to the first command and create a condition like this: if touches the edge, go to the new location of the second background and to coordinates -207 and -2.

Image looks like text, screenshot, internal, computer Automatically generated description

Image looks like text, screenshot, internal, computer Automatically generated description

4.2. Drawing and programming a part for teleportation to the battle map

Here is the detail that can be drawn:

Image looks like text, screenshot, monitor, other Automatically generated description

Image looks like text, screenshot, monitor, other Automatically generated description

We need a code with the command “when the flag is pressed, hide”. The drawn detail should appear after getting to the second location, so we go to the program for the character and insert the message “key” at the end.

Image looks like text, screenshot, internal Auto generated description

Image looks like text, screenshot, internal Auto generated description

But the conventional teleporter itself needs a visual code. Here's what you need to write: when a message is received, show up and go to one of the road branches with coordinates 137 and 112.

Image looks like text, screenshot, internal Auto generated description

Image looks like text, screenshot, internal Auto generated description

We go to the script for Avery and create a condition: if it touches the key, transmit the message “game”.

Image looks like text, screenshot, internal Auto generated description

Image looks like text, screenshot, internal Auto generated description

Next, you need to program the following: when you receive the message “game” you need to hide. The command must be created for the key and the character.

Image looks like text, screenshot, internal Auto generated description

Image looks like text, screenshot, internal Auto generated description

Image looks like text, screenshot, internal, computer Automatically generated description

Image looks like text, screenshot, internal, computer Automatically generated description

4.3. Create a new sprite – a pixel heart

Before making the game “Undertale” in the “Scratch” environment, you need to clarify the following point: during battles, the main character becomes a heart. We will need to create it. We select red squares and draw.

Image looks like text, screenshot, monitor Auto generated description

Image looks like text, screenshot, monitor Auto generated description

You can't do without code. You need a command like this: when the flag is pressed, hide, when the message “game” is received – show up and go to coordinates 4 and -97, turn on the fourth background.

We will set the size of the heart at forty units.

Now we need to select an infinite loop and insert it inside the motion condition. We will control the heart not with arrows, but with letters.

Here are the commands needed:

  1. If W is pressed, change Y to 10.

  2. If D is pressed, change X to 10.

We do the same with S and A, we write: change Y by -10 and X by the same amount, respectively.

Let's temporarily place the background change inside the loop and remove it later.

Image looks like text, screenshot, internal Auto generated description

Image looks like text, screenshot, internal Auto generated description

4.4. Making a monster in the form of a frog

Now it's time to create a monster. We'll start with drawing:

  1. Let's take a white oval and remove the bottom part by changing the points.

  2. Let's add two circles – improvised eyes.

  3. Let's draw the body, changing the upper part using dots.

  4. Let's make two ovals in the form of legs with additional oval elements – paws – at the ends.

  5. Let's add an arc in place of the belly.

This is what you should get:

Now we need an eraser. Let's make it thin and set the size to ten: this will help us to accurately draw the mouth and eyes for the improvised monster.

Image looks like text, screenshot, monitor Auto generated description

Image looks like text, screenshot, monitor Auto generated description

The next step is to select and combine the frog's body parts. Set its size to 50, drag the monster into the field with the previously created green cells.

All that's left is to write the block code. Here are the commands needed:

  1. When the flag is pressed, hide.

  2. When I get the game message, show up and go to coordinates 1 and 66.

  3. Repeat loop forever, change Y to 1 and wait 0.2 seconds, change Y to -1 and wait another 0.2 seconds.

Thanks to the code, our frog will be able to move.

4.5. Drawing and programming the projectile

The projectile in our project is a “dangerous enemy”: it will need to be dodged. Let's create a corresponding sprite.

For drawing we will need a white circle, and for the code – the command “when the flag is pressed, hide”. Additionally, we will write: when I receive the message “game”, show up and go to coordinates 39 and 78. Other important blocks:

  1. Repeat the cycle 10 times.

  2. Create your own clone and go to random coordinates. They will be chosen by a random number generator. Ranges: by X -2–253, by Y – from -173 to -63.

Next we write an additional command: swim one second to the heart. And also write the following: when I start as a clone, when touching the first sprite, change HP to -1 and delete the clone, otherwise just delete.

Now let's change the time allotted for the projectile's movement. Instead of one second, we set the value to 0.8.

Image looks like text, screenshot, internal Auto generated description

Image looks like text, screenshot, internal Auto generated description

5. Making the final touches

Let's change the heart rate: instead of ten, we'll set the value to five.

Now let's go to the code written for the character and add a condition to the end. It looks like this: if HP = 0, we lose. The game stops.

Let's remember how many backgrounds there were to understand that there is one unused one left. It will come in handy in case of a successful improvised battle with a monster. Let's add the command for the projectile with the message “background 3” as shown on the screenshot.

We will also change the character script and write the following: when I receive the message “background 3”, show up and go to coordinates -207 and -2. Additionally, we will need to set the switching of the conditional location accordingly.

Image looks like text, screenshot, internal Auto generated description

Image looks like text, screenshot, internal Auto generated description

All other elements should disappear. This can be programmed using the same command: when I receive the message “background 3”, hide.

Image looks like text, screenshot, internal Auto generated description

Image looks like text, screenshot, internal Auto generated description

Image looks like text, screenshot, internal Auto generated description

Image looks like text, screenshot, internal Auto generated description

Image looks like text, screenshot, internal Auto generated description

Image looks like text, screenshot, internal Auto generated description

Image looks like text, screenshot, internal Auto generated description

Image looks like text, screenshot, internal Auto generated description

Image looks like text, screenshot, internal, multiple Automatically generated description

Image looks like text, screenshot, internal, multiple Automatically generated description

Let's go back to the code for the heart and remove the “switch background 4” construct from the loop so that we can return to the third location.

Image looks like text, screenshot, internal Auto generated description

Image looks like text, screenshot, internal Auto generated description

Image looks like text, screenshot, internal, multiple Automatically generated description

Automatically generated description

So, our instructions have come to an end. We hope that everything worked out!

If errors occur, we advise look training video: it will help you understand how to make an RPG in the Scratch environment using Undertale as an example.

And we would like to ask you to tell us whether you managed to write the visual code according to the instructions. If not, tell us what difficulties you encountered? Share your opinions, leave comments: this will help us make more informative and simple lessons for children.

The material was prepared by the Pixel programming school. We teach children who are passionate about IT to write code, create 3D models, script websites and more. If you want to delve deeper into Scratch programming, come to our courses for the younger ones And for seniors students.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *