Book Image

Godot 4 Game Development Projects - Second Edition

By : Chris Bradfield
5 (1)
Book Image

Godot 4 Game Development Projects - Second Edition

5 (1)
By: Chris Bradfield

Overview of this book

Godot 4.0 is one of the most sought-after open-source game engines, and if you’re enthusiastic about exploring its features, then this book is for you. Written by an author with over twenty-five years of experience, the Godot 4 Game Development Projects introduces the Godot game engine and its feature-rich 4.0 version. With an array of new capabilities, Godot 4.0 is a strong alternative to expensive commercial game engines. If you’re a beginner, this book will help you learn game development techniques, while experienced developers will understand how to use this powerful and customizable tool to bring their creative visions to life. This updated edition consists of five projects with an emphasis on the 3D capabilities of the engine that will help you build on your foundation-level skills through small-scale game projects. Along the way, you’ll gain insights into Godot’s inner workings and discover game development techniques that you can apply to your projects. Using a step-by-step approach and practical examples, this book covers everything from the absolute basics to sophisticated game physics, animations, and much more. By the time you complete the final project, you’ll have a strong foundation for future success with Godot 4.0 and you’ll be well on your way to developing a variety of games.
Table of Contents (10 chapters)

Pausing the game

Many games require some sort of pause mode to allow the player to take a break from the action. In Godot, pausing is a function of the SceneTree and can be set using its paused property. When the SceneTree is paused, three things happen:

  • The physics thread stops running
  • _process() and _physics_process() are no longer called on any nodes
  • The _input() and _input_event() methods are also not called for inputs

When pause mode is triggered, every node in the running game reacts accordingly, based on how you’ve configured it. This behavior is set via the node’s Process/Mode property, which you’ll find near the bottom of the Inspector list.

The pause mode can be set to the following values:

  • Inherit – The node uses the same mode as its parent
  • Pausable – The node pauses when the scene tree is paused
  • When Paused – The node only runs when the tree is paused
  • Always – The node always...