How to Make a Scratch Horror Game With a Flashlight

Michael Murr··17 min read

Last updated: October 2026

This is how to make a horror game on Scratch that actually feels scary: a pitch-dark room, a flashlight beam that follows your player, a key hidden somewhere on the floor, one scare, and a door out. By the end you will walk a character through the dark, spot the key only when your beam passes over it, and escape as the lights come back on.

It takes seven small steps, and every step ends with a checkpoint so you know it works before you move on. The flashlight is the clever part. I will explain exactly why it works, including the one Scratch limit that quietly breaks most first attempts.

Parents: if you would rather your child builds this with a tutor beside them, that is exactly what my 1-on-1 Scratch lessons are for, and a free Discovery Call is where we start.

Table of Contents

What you need before starting

  • A Scratch account at scratch.mit.edu. Scratch is free for everyone, and signing in means your project saves as you go.
  • Some comfort with when green flag clicked, forever and if <> then. If if blocks are still new, start with this walkthrough of if statements and come back.
  • One sitting. The build is scoped so it can be finished in a single session, as long as you test each step before starting the next.
  • Headphones, if you want the scare to land.
  • Optional: the finished game, to compare against as you go. Download the project file, then in Scratch choose File, then Load from your computer. I built it from these exact steps and tested every checkpoint in the Scratch editor. It uses sprites and sounds from Scratch's own library.

Step 1: Set up the room and your player

Start a new project. The cat that appears is your player. In the sprite info panel under the stage, change its name from Sprite1 to Player. The name matters, because later blocks will point at this sprite by name.

Now pick a room. Click the Choose a Backdrop button in the bottom right and pick something indoors, such as Witch House or Bedroom 1. You will barely see it once the lights go out, but you will see it at the end, and it helps while you build.

Give the Player this script:

when green flag clicked
set size to (50) %
go to x: (-180) y: (-120)
forever
  if <key [right arrow v] pressed?> then
    change x by (4)
  end
  if <key [left arrow v] pressed?> then
    change x by (-4)
  end
  if <key [up arrow v] pressed?> then
    change y by (4)
  end
  if <key [down arrow v] pressed?> then
    change y by (-4)
  end
end

Three decisions in there are worth knowing about. The four arrows each get their own if block rather than one if else, so holding two keys moves the cat diagonally. The size drops to 50 percent so the room feels bigger around a small character. And 4 steps per loop is slow on purpose. Horror works better when you cannot run away quickly, and if you want to see how step size turns into speed on screen, this animation speed experiment shows it well.

Unlike the Scratch platformer tutorial, there is no gravity here. This is a top-down room, so the up arrow means further into the room, not a jump.

Checkpoint: click the green flag. The cat shrinks, jumps to the bottom-left of the room, and walks in all four directions with the arrow keys, including diagonally when you hold two keys at once.

Step 2: Add a walking bob

This step looks like decoration. It is not. One of the lessons from a teenage student's horror-game build was that the slight bob a character makes while walking is a feature: without it, they look like they are floating. Once your character is surrounded by darkness with nothing else moving, a perfectly smooth glide looks like hovering, and the whole game feels wrong without anyone being able to say why.

Add this as a second, separate script on the Player:

when green flag clicked
forever
  if <key [any v] pressed?> then
    change y by (3)
    wait (0.1) seconds
    change y by (-3)
    wait (0.1) seconds
  end
end

It is a separate script for a reason. Those wait blocks would slow the movement loop down if they sat inside it. As two scripts, Scratch runs them side by side: one moves the cat, the other bounces it. The any option in the key block covers all four arrows with a single block.

If you want legs as well as bounce, add next costume just under the first change y by (3). The cat has two costumes, and swapping between them makes it look like it is stepping.

Checkpoint: walk around. The cat now bobs up and down by a few pixels while it moves, and stands completely still the moment you let go of the keys.

Step 3: Paint the darkness

Here is the trick behind every Scratch flashlight. The light is not a light at all. It is a sheet of black with a round hole cut in it, sitting in front of everything else in the game. Wherever the hole is, you can see through. Keep the hole on top of the player and it looks exactly like a beam.

Hover over the Choose a Sprite button and click Paint. Name the new sprite Darkness. Then, in the Costumes tab:

  1. Pick the Circle tool, set the fill to grey (any colour you can see is fine), and draw a circle about an eighth of the width of the canvas.
  2. Drag the circle to the middle of the canvas. The Scratch Wiki's paint editor guide explains that the costume centre is marked by a crosshair in the middle of the canvas, and an object snaps to it when you drag it close. Let it snap. The centre of the costume is the point that will follow the player.
  3. Click Convert to Bitmap.
  4. Pick the Fill tool, choose black, and click anywhere outside the circle. Everything around the circle turns black, right to the edges of the canvas.
  5. Keep the Fill tool, open the colour picker and click the white box with the red diagonal line. That is the invisible colour. Click inside the grey circle, and the circle becomes see-through.
  6. Rename this costume dark.
  7. Add a second costume with the Paint option, draw one tiny dot with the Brush, and name it dot. It looks pointless. Step 4 needs it.

You may see a thin ring of stray pixels around the edge of the hole. Leave it. It reads as the soft edge of a beam.

While you are building, you will want to click and drag the other sprites, and a black sheet on top of the stage gets in the way. In the sprite info panel, set Show to the closed eye for Darkness. The script in Step 4 switches it back on every time you click the green flag.

Checkpoint: the dark costume thumbnail shows a black rectangle with a round hole in the middle, and the dot costume looks almost empty. Do not worry that the darkness does not cover the stage yet. That is the next step's job.

Step 4: Make the flashlight follow the player

Give the Darkness sprite this script:

when green flag clicked
show
switch costume to [dot v]
set size to (250) %
switch costume to [dark v]
go to [front v] layer
forever
  go to [Player v]
end

Every block here does a job, so here they are one at a time.

go to [front v] layer puts the darkness on top of every other sprite. The Scratch Wiki on this block puts it plainly: a sprite at the front layer cannot be covered by another sprite. So the player, the key and anything else you add all sit underneath the black sheet.

go to [Player v] inside the forever loop moves the centre of the darkness, which is the centre of the hole, onto the player many times a second. Walk, and the hole comes with you.

Now the part that breaks most first attempts: the size. Bitmap costumes can be at most 480 by 360, which is exactly the size of the stage. That sounds perfect until your player walks to the right-hand wall. The darkness is centred on the player, so its left edge gets dragged away from the left wall, and light leaks in. To cover the stage wherever the player stands, the darkness needs to be more than twice the size of the stage.

You cannot just ask for that. Scratch has a size limit: a sprite must not be visually larger than 150% of the dimensions of the stage on either axis. Put a stage-sized costume on and ask for 250 percent, and Scratch quietly stops at 150.

The limit is worked out from whichever costume the sprite is wearing when you set the size. That is what the dot costume is for. The Scratch Wiki describes this exact workaround in its page on overriding the costume size limit: switch to a tiny costume, set the size, then switch back. A tiny dot is allowed to be scaled up enormously, so 250 percent goes through. Then the script switches back to dark, and the darkness keeps its new size.

At 250 percent the darkness is 1,200 by 900, which covers the stage from any spot with room to spare. The hole grows by the same amount, which is why you drew it small.

If you want the faintest hint of the room to show through the dark, add set [ghost v] effect to (10) just above the forever block. The ghost effect makes a sprite partly transparent, from 0 (solid) to 100 (invisible). A small number keeps it scary.

Checkpoint: click the green flag. The whole stage goes black except for a circle of light around your cat. Walk into all four corners. The black should reach every edge, and the circle should stay centred on the cat the whole time. If the light sits off to one side of the cat, the hole was not centred in Step 3.

Step 5: Put a key on the floor

Before we add anything to hold the key, we add the key itself. That order comes straight from the same teenage student's build. The plan there was to design the inventory screen first, and I steered it the other way: put the item on the ground, make it possible to pick up, and only then build the inventory to hold it. You cannot tell whether an empty inventory works.

Click Choose a Sprite and search for Key. Scratch has one in its library. If you would rather draw your own, a circle and a rectangle in a gold colour is plenty.

Two small changes make the key read as something worth picking up, and both came out of that build.

Make it slightly larger than life. A real key next to a real cat would be tiny. In a game, the floor version of an item should be a little too big, so a player can tell an item from part of the floor.

Give it a white outline. Without one, an item on the floor reads as junk once the room has any clutter in it. In the Costumes tab, pick the Select tool, drag a box around the whole key, set the Outline colour to white and the outline width to about 4.

Then give the Key this script:

when green flag clicked
set size to (45) %
go to x: (150) y: (120)
show

The size of 45 percent is a starting point, not a rule. With the cat at 50 percent, the key should look a little too big next to it. Adjust by eye until it does.

Checkpoint: click the green flag and walk up and to the right. The key stays invisible until your beam reaches it, then pops out of the dark, white outline first. If it only appears when you are standing right on top of it, make it a bit bigger or move it somewhere more open.

Step 6: Pick up the key

Now the key needs to be collectable. Add six blocks to the bottom of the Key's script, so the whole thing reads:

when green flag clicked
set size to (45) %
go to x: (150) y: (120)
show
wait (0.1) seconds
wait until <touching [Player v]?>
set size to (30) %
go to x: (-200) y: (150)
go to [front v] layer
broadcast [got key v]

wait (0.1) seconds gives the Player's own green flag script a moment to walk the cat back to its starting spot. Without it, clicking the green flag while the cat is standing where the key lies makes the key pick itself up before the cat has moved, and it vanishes into the dark corner.

wait until pauses the script until the player walks into the key. Then the key shrinks, jumps to the top-left corner, and goes to the front layer. That last part matters: the darkness is at the front, so without it the key would disappear into the black. Moving it in front of the darkness makes it visible in the corner, like an item sitting in your inventory.

That corner is your whole inventory: one slot. It exists because there is now an item to put in it, which is the right way round.

For broadcast [got key v], click the dropdown on the broadcast block, choose New message, and type got key. Nothing listens for it yet. Step 7 fixes that.

Checkpoint: walk into the key. It jumps to the top-left corner, smaller, and stays visible even though the rest of the room is dark. Now click the green flag again. The key should be back on the floor and hidden in the dark, because the darkness moves to the front layer again at every green flag and ends up on top of it.

Step 7: Add the scare and the way out

Three things happen after the key: a ghost appears, a door starts working, and escaping turns the lights back on.

First the ghost. Click Choose a Sprite and pick Ghost from the library. In its Sounds tab, click Choose a Sound and add Spooky String. Then give the Ghost two scripts:

when green flag clicked
hide

when I receive [got key v]
wait (1) seconds
go to x: (-200) y: (0)
go to [front v] layer
show
start sound [Spooky String v]
glide (1) secs to [Player v]
hide

The ghost goes to the front layer before it appears, so it is the one thing in the room you can see without your flashlight. That is what makes it scary. It glides straight at the player for one second, then vanishes.

Next the door. Paint a new sprite, a brown rectangle with a small circle for a handle is enough, and name it Door. Add the sound Door Creak in its Sounds tab. Then:

when green flag clicked
go to x: (200) y: (-120)

when I receive [got key v]
wait until <touching [Player v]?>
start sound [Door Creak v]
broadcast [escaped v]

The door only starts paying attention once the key has been collected, so walking into it early does nothing.

Finally, the ending. Add this to the Darkness sprite:

when I receive [escaped v]
hide

And this to the Player:

when I receive [escaped v]
say [I escaped!] for (2) seconds
stop [all v]

When the player reaches the door, the darkness hides, so the lights come on and the whole room appears at once. The cat announces its escape, and stop [all v] ends the game.

Checkpoint: play the whole thing from the green flag. Walk through the dark, find the key, and watch it jump to the corner. About a second later the ghost swoops at you with a spooky sound. Find the door in the bottom-right corner and walk into it: it creaks, the lights come on, and the cat says "I escaped!" before everything stops. Try touching the door before you have the key. Nothing should happen.

Where this breaks

Light leaks in at the edges. The size trick did not work. Check that switch costume to [dot v] comes before set size to (250) % in the Darkness script, and that the dot costume really is tiny. If the first green flag looked fine and the leak only appeared from the second click, the dot line is missing: the first run only worked because the sprite was still wearing the dot you drew in Step 3. The Scratch Wiki is honest that going beyond the limits can behave unexpectedly, with no guarantee that the sprite looks the same on every device. If the darkness ever looks wrong on one computer, the fallback is to drop the dot lines and use set size to (150) %. It is only a partial fix: at 150 percent the darkness covers the stage only while the player stays within about 120 steps of the centre left to right and 90 up and down, so light leaks in at the far side as soon as the player walks toward an edge, including at the starting position.

You cannot click or drag anything on the stage. The darkness is on top of everything, which is its job. Set its Show toggle to the closed eye while you edit. The green flag script shows it again.

Something shows through the dark that should not. A sprite went to the front layer after the darkness did. Only three things in this game should ever use go to [front v] layer: the darkness at the start, the collected key, and the ghost.

The light sits off to one side of the player. The hole is not at the centre of the costume. Paint it again, and this time let the circle snap to the centre crosshair before you click Convert to Bitmap.

Trying to build it all in one go. This is the mistake I most want to save you from. In that teenage student's horror-game build, one attempt to make the floor item, the pickup and the inventory screen together took about thirty minutes and was still not finished when the lesson ended. The floor item and the pickup on their own would have been. Every step in this tutorial is small on purpose, so that when something breaks you know exactly which few blocks to look at.

Frequently Asked Questions

How do I make the flashlight follow the mouse instead of the player? In the Darkness script, change go to [Player v] to go to [mouse-pointer v]. The player still walks with the arrow keys, but now you aim the light separately, which is harder and much creepier, because you can lose sight of your own character.

Is this project too scary for a younger child? It is as scary as you make it. This version has one ghost, one sound and no chasing. A younger child can swap the ghost for a friendlier sprite and the sound for something silly, and the flashlight effect is just as much fun either way.

What does my child need to know before trying this? They should have built one or two Scratch projects already and be comfortable with forever loops and if blocks. Step 3 is the fiddly part, with the most clicking in the paint editor, so that is the step where it helps to sit beside them.

What to build next

The natural next step is a battery. Paint two more versions of the dark costume with smaller holes, make a battery variable that drops every few seconds, and switch to a smaller hole as it runs down. Now the player has a reason to hurry.

After that, add a second item. That is the moment an inventory screen earns its place, because there is finally more than one thing to hold. Keep it small: five or six slots is plenty for a game one person is making, and a small inventory forces the player to choose what to carry. The usual key for opening an inventory is I, so when [i v] key pressed is a sensible place to start.

If you want to build this with someone watching your screen, who can spot the moment the darkness starts leaking light, that is what my lessons are. Emma, a parent whose daughter builds Scratch games, summed up what she valued as "One-on-one instruction that goes at your pace." Book a free Discovery Call and bring this project with you.

This build comes from the kind of project I teach 1-on-1. I built the finished project from these exact steps and tested every checkpoint in the Scratch editor.

Enjoyed this article?

Your child can learn this and more with a dedicated 1-on-1 tutor.

Book a Free Discovery Call