How to make a game without coding — for free!

Broken Piano
12 min readOct 13, 2021

--

Have you ever thought about making a video game? You probably have, since you’re reading this article. Making your own video game is a dream that many have; unfortunately, most of the time you need to know how to code to make a fully functional video game.

However, there is one exception: Scratch. The Scratch game engine lets anyone make a game, no matter how big or small. You don’t need to know how to code to use Scratch, and it’s fully online, meaning that you don’t need to download anything.

Be warned, though: Scratch, like any other game engine, still has a learning curve. But once you learn the ropes, it’s a very simple and powerful system that you can make any type of video game with.

The Scratch Engine

To access Scratch, go to https://scratch.mit.edu on any Internet browser. If you want to code from mobile, you can search up Scratch in your app store and download it from there.

You’ll find yourself here:

Click the button that says “Join Scratch” on the top right corner, decide a username and password, and create your account!

Now you’ll see something similar to this:

To start making your first game, click the “Create” button on the top bar.

Before we start, it should be known that you can play games made by other people on Scratch, and other people can play yours. Once you finish any games you make, you can publish them and anyone can play them.

Now you should be in the Scratch interface:

There are multiple parts of the interface:

  • Block Sidebar: the sidebar on the left. There are tons of different blocks to use here. They are separated into 9 main categories. Click the categories on the side to switch to that category, or just scroll down to manually go through each one.
  • Tabs: on top of the blocks sidebar there are 3 tabs that you can select. These are “Code”, “Costumes”, and “Sounds”. We’ll go over how to use these later. For now, keep it at “Code”.
  • Block Area: the giant empty area in the middle of the screen. Here you can drag and drop blocks to make things happen! For now it’s empty, but we’ll fill it up soon.
  • Stage: the Stage is the square on the top right of the interface. You can see Scratch Cat there, Scratch’s mascot. The stage is where your game happens!
  • Sprite Area: below the Stage is the Sprite Area. You’ll find all the sprites that you make and use here, and above it you can change their name, position, rotation, size, and visibility. We’ll go in detail into sprites in a bit.

In Scratch, you make everything happen using blocks. These blocks can be found in the Block Sidebar. You can drag blocks out of the sidebar and drop them in the Block Area.

Clicking any blocks you place in the Block Area will make that happen! For example, the “move 10 steps” block moves Scratch Cat a little bit to the right. Click it and see what happens!

Sometimes one block isn’t enough; you can connect blocks to make chain reactions. Clicking the top block in a block chain will activate all the blocks.

When clicking the blocks, it seems like they all activate at the same time instead of right after each other. However, the computer is in fact activating them one at a time. It’s activating the blocks so fast that we think they’re all at the same time.

In Scratch, objects are called sprites. A sprite can be a character, obstacle, button, anything! Each sprite has their own Block Area and their own blocks that they respond to.

Let’s create a new sprite! First, click that cat plus button in the corner of the Sprite Area:

There are multiple ways to create a sprite, but we’re going to choose one from Scratch’s library, so click the magnifying glass.

That’s a lot of sprites! Scratch has a huge library of premade sprites each with their own unique costumes and sounds. For now let’s choose the apple to be in our game.

Now we have an apple in our game. The blocks that we dragged into the Block Area are gone, because those were in the Scratch Cat sprite. If we click Scratch Cat (Sprite1) in the Sprite Area, we’ll see the blocks again.

Remember: each sprite has their own Block Area and blocks!

User Input

The best part of a game is what separates it from a movie — you are in charge! In order for this to happen, we need to get input from the player. We can get input in 2 main ways:

  • Keyboard input: any key pressed, held, or let go
  • Mouse input: whether or not the mouse is clicked, where the mouse is clicked, and the mouse’s position

We’re going to be using both these methods of input for our game. First, let’s start with keyboard input.

Up until now, we’ve been activating our blocks by clicking them. However, we’ll need these blocks to run on their own to make the game fully functional. For this to happen, we need an event block.

Click the “Events” category in the Block Sidebar:

These blocks look different because they’re the ones that start a chain of blocks. Each block chain needs one of these on top.

Drag out the “When space key pressed” event block. Make sure you’re selecting Scratch Cat.

Now we can attach one or more blocks. Choose any block in the “Motion” category (such as “move 10 steps”) and attach it to the event block.

That’s it! Try pressing space on your keyboard and watch Scratch Cat move!

If you’re on mobile, replace the “When space key pressed” block with “When this sprite clicked”, then click the Scratch Cat and see what happens.

If you kept moving Scratch Cat, you saw that he eventually got to the end of the Stage and couldn’t move anymore. The maximum positions depend on the sprite, but they are usually around 250, -250, 215, and -215. The center of the Stage is (0, 0).

You can drag any Sprite in the stage anywhere you want. Click Scratch Cat and drag him to the middle, or set his X and Y positions to 0 in the space above the Sprite Area.

You might have noticed that the word “space” looks different than the rest of the event block. Clicking the word “space” opens a drop-down menu of every key on the keyboard. Here you can select a specific key that needs to be pressed to move Scratch Cat.

The motion doesn’t really feel fluid, though. To fix this we’ll need to check every frame if the button is pressed. We can use a sensor block to do this.

Click the “Sensing” category and drag the “key space pressed?” hexagon block to the Block Area.

Unlike rectangle blocks, which do something, hexagon blocks output either true or false. Also unlike rectangle blocks, these blocks are always active and are always outputting their value. You can click the block to see it’s value.

Now try holding the space bar and clicking it.

Note: the mobile equivalent is “mouse down”, though it checks if anywhere on the Stage is clicked instead of a specific sprite.

Ok, so we’ve got a block that checks if we’re pressing a key. What now? We need to check this value every frame of the game. We’ll need 2 new blocks, both found in the “Control” category.

Both of these are C blocks. You can build new block chains inside of these C blocks, which are different than the ones outside of them.

The Forever block repeats what’s inside of it over and over from the time that it was activated to the end of the game. We can pair this with the “when flag clicked” event block to have blocks running for the entire game.

The If block does something totally different: it checks if a specific hexagon block is true, and if it is, runs the code inside of it.

Pairing the Forever, If, Key space pressed, and When flag clicked blocks together allows us to check a value for the entire game:

For the entire game, if the space key is being pressed, the code inside will run. There’s nothing inside yet, though! Let’s add the “move 10 steps” motion block inside to finish.

Make sure to also remove the “move 10 steps” block from the original event block. You can do this by dragging the block off of it.

Try moving Scratch Cat to the middle and clicking the green flag above the Stage. What happens when you hold the space bar?

That definitely feels much smoother than before.

But what’s the difference between these two blocks? They both seem like the same thing, but have different results.

The “when space key pressed” event block runs all the code beneath it when it gets a signal that the space key was pressed. Each time that it gets that signal, it runs the code beneath it.

The forever if block of “key space pressed” checks for the entire game if the space key is pressed, so at the exact second that the key is pressed, it reacts and runs the code. This also makes Scratch Cat stop moving the second you stop pressing space.

You can right click the top block of a chain and click “duplicate” to duplicate the entire chain. Do this four times, and change the hexagon blocks to “right arrow”, “left arrow”, “up arrow”, and “down arrow”.

Even though the chains all have different keys they’re checking for, they all make Scratch Cat move right when pressed! To change which way he’s moving, we’ll need to change the inner block.

The “move 10 steps” block works depending on the sprite’s rotation. For example, if he’s facing right, he’ll move to the right. If he’s facing up, he’ll move upwards. So to fix this, we’ll need to change his rotation. We can do this with the “point in direction” motion block.

  • 90 degrees = right
  • 0 degrees = up
  • -90 degrees = left
  • 180 degrees = down

Drag these blocks right before the “move 10 steps” blocks, and click the “90” to change the direction. When you’re finished it should look something like this:

Remember to make the directions correspond with the keys pressed!

Now click the green flag and use the arrow keys to move Scratch Cat!

If you don’t want Scratch Cat to rotate, drag the “set rotation style” motion block into the Block Area, set it to “don’t rotate”, and click it. It doesn’t need to be attached to any block chain.

Note: if you’re on mobile, the equivalent is this:

It’s the same concept, but it’s checking if you’re touching anywhere on the screen, and if you are, it moves Scratch Cat to where you’re touching.

Interacting With the Apple

Yep, it’s time to go back to the apple! Welcome back old friend!!

To finish up this tutorial, we’re going to make the apple a collectible. Once Scratch Cat touches it, it’ll disappear and a chomping sound is going to play.

First and foremost, click the apple in the Sprite Area.

Now that we have a clean Block Area, it’s time to fill it up.

Since we want the apple to be visible at the start of the game but invisible once Scratch Cat touches it, we’ll need to use the “Show” and “Hide” looks blocks.

The “Show” block makes a sprite appear, while the “hide” block makes it disappear.

We’ll want to make the apple appear when the game starts:

We need this so if the apple gets eaten and then you restart the game, the apple re-appears.

To make it disappear when Scratch Cat touches it, we’ll need to check every frame of the game if it’s touching Scratch Cat. And of course, to do that, we’ll need a Forever and If combo.

The hexagon “touching” block is found at the top of the Sensing category. You’ll have to change it’s value from “mouse pointer” to “Sprite1” for it to sense Scratch Cat.

Now move Scratch Cat away from the apple in the stage if they’re touching, and click the green flag! The apple gets eaten!

To make this funnier, let’s use the chomp sound effect to show that Scratch Cat is eating the apple. Go to the “Sound” category, and drag the “start sound chomp” block right before the “hide” block.

Now when the apple is eaten, it makes the chomp sound!

If you right click a sprite in the Sprite Area and then click “duplicate”, you can make duplicates of a sprite, and they’ll keep all their blocks, costumes, and sounds. You can do this a few times and drag the apples throughout the stage to make the game more exciting.

And We’re Done

Congratulations! You’ve finished your very first game!

Ok yeah, it’s not the best game at all. But it can be. Scratch may be simple, but it has the potential to make some very great games. For example, see my game Battle Jellies:

It’s a fully-fledged game with different jellies, enemies, treasures, stages, and the ability to upgrade and evolve these jellies with candy you get from beating stages. There are over 100 different stages you can play, with 2 story mode chapters, special stages, limited-time events, and endless mode.

And I made it all in Scratch.

Again, it’s recommended that you check out games that others have made: they can give you inspiration and ideas for your games.

I’ll be posting multiple different tutorials in the future for all different kinds of games on Scratch: platformers, tower defense, RPGs, clicker/simulation, and more! I hope these series will help you learn how to use Scratch so you can make your own games easier and faster.

Thanks for reading, and see you in the next article!

--

--

Broken Piano
0 Followers

The official Medium account for Broken Piano!