02.designing-the-character-scene

Designing the character’s scene

In this video, we’ll set up the character’s nodes.

To follow along, please open the godot-practices project.

The game’s visuals and collisions

In games, what the player sees is entirely different from the world’s physical model for the computer. The walls, the characters’ bodies, and physics shapes rely on simple geometry.

This is what the player sees.

And this is what the computer uses to calculate physics interactions.

Your computer has a limited amount of processing power. Every physics interaction, like stopping when you hit a wall, requires many calculations. To help with performance, games use simple geometry for physics.

With circles, squares, capsules, and other shapes, developers greatly speed up physics calculations compared to pixel-perfect interactions. This is why, in the video, we added a circle collision shape to our character.

As game developers, part of our job is to give the illusion that the game’s physics and visuals line up. You need to position and size collision shapes to fit your game’s objects.

New concepts

The KinematicBody2D node

In this video, we use Godot’s KinematicBody2D node for the first time. This node is a physics body: an object that can collide with walls, the floor, and other game objects.

Most game engines have three kinds of physics bodies:

  1. Kinematic bodies.
  2. Rigid bodies.
  3. Static bodies.

Kinematic bodies are for characters and objects you want to move manually, like our top-down character. Rigid bodies automatically bounce and push one another when they collide. Finally, static bodies are for obstacles like walls, closed doors, etc.

In this course, we focus on kinematic and static bodies, as they’re the ones you’ll tend to use the most. For characters and monsters, as seen in games like The Binding of Isaac, Celeste, or Dead Cells, you’d use kinematic bodies.

Godot’s KinematicBody2D node comes loaded with functions that make it easy to create working characters. As you’ll see in this series, we can make our character move, collide, and even smoothly slide against round objects with a single function call.

Collision shapes

Physics bodies require at least one collision shape to work. They’re geometric shapes that allow the computer to calculate physics interactions. In Godot, you add a collision shape in the form of a child CollisionShape2D or CollisionPolygon2D node.

Sprite sheets

Sprite sheets are images with multiple drawings laid out on a grid. In this series, we use a sprite sheet with three columns and two rows. In each cell, we have a drawing of a character looking in a different direction (and dead in the last cell).

Game artists will sometimes produce game graphics in the form of sprite sheets. They’re an efficient way to work as artists can draw one sprite in each texture cell.