Book Image

Godot Engine Game Development Projects

By : Chris Bradfield
4 (1)
Book Image

Godot Engine Game Development Projects

4 (1)
By: Chris Bradfield

Overview of this book

Godot Engine Game Development Projects is an introduction to the Godot game engine and its new 3.0 version. Godot 3.0 brings a large number of new features and capabilities that make it a strong alternative to expensive commercial game engines. For beginners, Godot offers a friendly way to learn game development techniques, while for experienced developers it is a powerful, customizable tool that can bring your visions to life. This book consists of five projects that will help developers achieve a sound understanding of the engine when it comes to building games. Game development is complex and involves a wide spectrum of knowledge and skills. This book can help you build on your foundation level skills by showing you how to create a number of small-scale game projects. Along the way, you will learn how Godot works and discover important game development techniques that you can apply to your projects. Using a straightforward, step-by-step approach and practical examples, the book will take you from the absolute basics through to sophisticated game physics, animations, and other techniques. Upon completing the final project, you will have a strong foundation for future success with Godot 3.0.
Table of Contents (9 chapters)

Game over

In this section, you'll make the player detect when it is hit by rocks, add an invulnerability feature, and end the game when the player runs out of lives.

Add an instance of the Explosion to the Player, as well as a Timer node (named InvulnerabilityTimer). In the Inspector, set the Wait Time of InvulnerabilityTimer to 2 and its One Shot to On. Add this to the top of Player.gd:

signal dead

This signal will notify the Main scene that the player has run out of lives and the game is over. Before that, however, you need to update the state machine to do a little more with each state:

func change_state(new_state):
match new_state:
INIT:
$CollisionShape2D.disabled = true
$Sprite.modulate.a = 0.5
ALIVE:
$CollisionShape2D.disabled = false
$Sprite.modulate.a = 1.0
INVULNERABLE:
$CollisionShape2D...