Top Down Movement - Module Overview

After this long foray into the basics of user interfaces, we can return to more "traditional" game-making!
In the first few modules, you learned to move Sprite2D and Area2D nodes by changing their position. This is a good start, but a limitaton is that these nodes don't handle collisions: they move through everything. While this is fine for some games, like the collectathon we made in module 5, most games require you to stop the player character against walls and obstacles. Godot has a node dedicated to that: CharacterBody2D! It is traditionally used for the player character, mobs, and other moving objects that obstacles should stop.
In this module, we'll keep ramping up the complexity, by having multiple scripts that interact. We'll also pay more attention to the game feel than before.
For this module, I've chosen to pretend we're participating in a game jam

Game Jam

Game jams are a staple of the game development community. They are events where developers come together to create games in a short amount of time, usually 48 hours or a week. The goal is to create a game based on a theme, which is usually revealed at the start of the event. Game jams are a great way to test your skills, learn new things, and collaborate with other developers.
More on Game Jam
. The theme of this game jam is "Race". Our goal is to create a simple top-down racing game where you control a little runner that has to reach the finish line.
We'll build the game over several modules spread throughout the rest of the course. In this module, you'll learn how to:
  • Handle 8-way movement in a top-down game.
  • Create walls or obstacles for the player to avoid or create walls.
  • Use assets provided by an artist.
  • Pause the game.
  • Restart the game when winning or losing.
In the next module, we'll expand upon this foundation and add traps, switches, and power-ups. And much later, we'll make it a couch-versus two-player game with a split screen!
Because this is a game jam, we'll simulate how you receive assets as they get created by the artist on your team. We'll have to figure out how to use them as we go. We'll use placeholders while waiting for the artist to finish the assets.
In this module, you'll explore the following concepts:
  • Character controller: Implement a relatively advanced top-down controller for your character, with acceleration and deceleration.
  • Obstacles: Learn how to create obstacles for your character to avoid with the StaticBody2D node. The CharacterBody2D, Area2D, and StaticBody2D nodes cover the needs of most games when it comes to 2D movement and detecting interactions. You can code all sorts of game characters with these three nodes.
  • Using people's assets: Learn how to use the assets provided by the artist in your team, read their provided documentation, and adapt them to your game.
  • Particles: Add particles to your game. Particles are everywhere in games, from dust to fire to explosions, you can't really escape using them. They're also very fun!
  • Cutscene basics: You will learn to take control away from the player and move the character yourself in code, which is the foundation for making cutscenes.
  • Game states: Implement a countdown before the game starts, a pause system, and a winning condition that restarts the game.
By the end of this module, you'll have learned the essential building blocks for 2D games, which will allow you to work on all sorts of simple games!

We ramped up the difficulty a notch

From here on, I won't provide detailed instructions anymore for things we've done many times, like adding a node or a script. You should be comfortable with these basic operations by now. This will give us more space to focus on important concepts and tips.
For functions, instead of explaining individual lines before adding them, I'll more often show you the code first, let you read it, and explain it afterward. You need to practice reading and translating code

Thinking in code

Reading code is one of the most foundational skills of any good game developer. Once the code makes sense as you read it, you can learn from any code example in the wild. It allows you to look up references and keep learning even when no documentation or articles explain something you want to achieve.
a lot.
Of course, I will continue to detail every line of code that introduces a new concept, though!
Until now, the games we made were very simple, and one or two scripts contained most of the code. The number of scripts and scenes will increase as we increase complexity to get closer to production game code. I count on you to double-check file names and ensure you're in the correct script when writing code. Stay focused!

Provided scenes

In this module, we will use a handful of premade scenes and scripts. For example, we'll use an animated character made by our artist for the player. This artistic work requires a skill set different from programming, and typically, in a game studio, the game artist is responsible for making scenes for animated characters. We call that integrating assets into the game.
Learning to use assets, scenes, and scripts made by someone else is essential in game development. Whether you buy assets on a marketplace, download them from Godot's open-source asset library, or get them from a teammate, you'll very likely have to work with assets you didn't create yourself. Be it to save time when prototyping or in game jams. It's the smart thing to do!
We won't explain the provided assets and scenes in great detail, but I fully commented their code if you want to study them. And if you have any questions about them, we'll be happy to help!
Nathan
Founder and teacher at GDQuest
In this module, you'll use:
  • An animated sprite of a runner that can rotate in all directions.
  • An outline shader to draw an outline around the runner.
  • A finish line that triggers the end of the game and spawns confetti when the player walks on it.
  • A big countdown that counts from 3 to 0 before the game starts.
  • A blur shader that blurs the game when the player pauses the game.
We'll describe these assets more when we get to them. In the next lesson, we'll start with the character controller. Let's goooo!

Lesson Q&A

Use this space for questions related to what you're learning. For any other type of support (website, learning platform, payments, etc...) please get in touch using the contact form.

  • Where are the downloaded filesahmed-yassineWhere are the downloaded files 2 1 Sep. 10, 2024
  • Art for gamedevenriikIt would be awesome to have some dedicated tutorials related to how to create assets as a pro. The "bite" of art shown here is inspiring! 3 0 Sep. 23, 2024
  • I think this is going to be the best Module yetheroicI really like the idea of the GDQuest moving the difficulty slider a bit. I think it's a great and safe way to help us learn. Let's Go-dot! 1 0 Sep. 11, 2024
Site is in BETA!found a bug?