How to Make a 3D Game in Scratch (Intermediate 8+)

POSTED ON JULY 20, 2021

Learn with Juni👋
Jumpstart your learning with Juni by getting exclusive content like our Juni's Guide to Learning in a Pandemic, subscribe for FREE!
Your Email

Make 3D Game in Scratch

3D games are popular, fun, and engaging. One of the most famous is Minecraft, celebrated around the world by programmers and gamers alike. In this tutorial, we’re going to show you the techniques on how to make a 3D project in Scratch!

Even though you can't technically create three-dimensional games in Scratch—it’s actually a 2D platform—it does allow for the illusion of 3D.

Ready to learn new Scratch game graphics skills? Let’s get started!

Why Make a 3D Video Game?

Along with being a ton of fun, Scratch prepares a coder age 8+ for more advanced programming languages and game engines (including Python and Unity). It does this through a visual block-based coding language.

Scratch 3D game development also helps you practice trigonometry. Don't be scared of the term! It basically means working with triangles. The triangle shape, which is a type of polygon, is everywhere in game creation.

Whether it's the first game or tenth, practice teaches game developers so much! Want to use Linux, iOS, Android, GitHub, and Unreal Engine later on? Starting with a solid foundation in Scratch ensures a successful path to more advanced scripting and game design.

Leveling up from 2D games to 3D design offers a whole new world of possibilities. It's one of the best ways to build your creativity and logical skills!

What You Need to Begin

Scratch is a high-level visual programming language. With a compatible device, browser, and Scratch account, you’re ready to go on a learning adventure!

Making a 3D Scratch project does require previous experience with Scratch coding. Once you explore the introduction to Scratch programming language and practice the basics, you’ll be ready to let your imagination soar with 3D video game development.

First time with Scratch 3.0? Don’t fret! Check out the following tutorials. Get up to speed and take your game design to the next level in no time:

Ready to jump into the 3D world of Scratch? Here we go!

3D Game Graphics Tutorial

What to Know Beforehand

Today, we’ll give you the building blocks for creating a 3D project in Scratch.

The key is the illusion of depth. Since the platform is used to make 2D games, it offers X axis (left and right perspective) and Y axis (up and down perspective) coordinates.

Three-dimensional platforms add a third axis called the Z axis, which runs at a right angle to the X axis and Y Axis, to create depth. Unlike a true 3D engine like Unity and Unreal Engine, Scratch uses movement and size changes to create the illusion of depth.

Scratch provides the functionality to build a 3D world with a 2D map. Once you've learned the techniques for 3D models and 3D characters, it's like magic!

For today's example, we'll show you concepts, scripts, and variables for making a 3D effect in Scratch (using size and perspective) to create a simple 3D maze.

This is done through the process of raycasting. It’s a project that creates a 3D world based on a 2D map. Read more on how a raycaster works on Scratch Wiki.

Let’s now look at the steps for building a basic 3D maze in Scratch!

Create a 3D Maze in Scratch

Step 1: Create 2D Maze

Before we get to the 3D fun, we’ll need to create a simple 2D maze.

How to make a 3d game in Scratch 1

Above, you’ll see a maze sprite drawn with green lines. The two opening points are the "exits" of your game.

With your maze, you can use raycasting to create the 3D effect.

To keep things simple, you can replicate the maze sprite example or even make one with less lines. Use an image to trace or draw your own. Whatever works better for you!

Next, duplicate your maze sprite. Label it "exit" and trace lines at the exits. Then, delete the duplicate maze and leave the trace lines.

How to Make a 3D Game in Scratch 2

Create a message that says "You Win!!!" or something to that effect. Use the code to trigger it when you pass the opening points ("exits").

How to Make a 3D Game in Scratch 3

Use the above script to display the winning message. Sound effect is optional.

Finally, create a player sprite.

Again, to keep it easy, draw a basic box. You can then use your pick of movement code. To freshen up on this type of Scratch code, read about how to make a sprite move (beginner) and how to make a sprite move smoothly (intermediate).

Once you’ve created your basic maze sprites, you'll be ready to create a radar!

Step 2: Make a Radar

Ready for some 3D magic? Let's do it!

What is a radar in Scratch? Essentially, it keeps track of the space between the player and the walls. This allows for the game visuals to adjust every time the player moves. This is accomplished with math built into the block coding.

How to Make a 3D Game in Scratch 4

Above, you'll find an example of radar code. Start by making a custom "define ()" block (the pink one). Be sure to check the "Run without screen refresh" box. Then add the other blocks with their corresponding variables.

Note: setting the angle to -50 degrees and the distance to 50 gives your player a 100-degree field of view (50+50=100).

How to Make a 3D Game in Scratch 5

Finally, use the above code to keep the player from walking through walls. Ready to get your 3D journey on the road? Let's finish up with rendering!

Step 3: Render with Scripting

Got the first two steps done? Awesome! This last step is pretty easy.

How to Make a 3D Game in Scratch 6

Basically, this sprite will allow for lines (or maze walls) to appear thicker when close and thinner from a distance. It’s a simple code as far as building it with Scratch blocks, but the 3D effect makes for a much more interactive experience!

How to Make a 3D Game in Scratch 7

As noted in the above “Make a Block” image, be sure to run without screen refresh! Otherwise, it won’t run properly.

How to Make a 3D Game in Scratch 8

There you go! Remember, this is just the beginning. There’s a whole world of possibilities out there with Scratch 3D modeling. Let your creativity flow!

Use this tutorial to sharpen your skill set. And if you want more inspiration, take a look at the best 3D projects on the Scratch website. With practice, you'll have confidence to work with 3D modeling in Unity, Blender, Unreal Engine, and more!

Great Job! Now Keep Exploring

Awesome work, Scratcher!

You now have the coding skills to create your own 3D project. Scratch makes it fun & user-friendly for coders of all ages. Experiment with your designs, explore Scratch projects, and even share your own game with the Scratch community!

Read more about our online coding classes for kids, or contact our Admission Team to learn which course is best for your student’s coding journey. You can also read more about how we use Scratch to teach coding.


Related Reading