00.tower-defense-introduction

A Tower Defense Game

In this project, you’ll create a few tower defense turrets and learn about game Artificial Intelligence (AI).

You will learn:

In this series, we want to focus entirely on AI and build upon what you learned in the obstacle course. That’s why we provide premade mobs that walk on a path. Our goal here isn’t to create a complete tower defense game from scratch.

As you’ll see later in the course, what you’ll learn here will directly apply to the final project’s enemies.

Progression

Our goal in this project is to create two turrets:

We’ll start with a small prototype to make two physics nodes interact.

We’ll build upon it to code a turret that detects when a mob is in range using the Area2D node.

We’ll then give the turret a cannon that shoots missiles at a target in range. The turret will need to determine the shooting angle, similar to what you did in To Space And Beyond!, and then instance and shoot a rocket.

Next, we’ll store multiple targets and select individual targets using arrays.

With the targeting system complete, we’ll be able to extend our base turret and create new variations: one that shoots multiple rockets simultaneously, and one that aims at the weakest mob in range.

Finally, we’ll take those turrets and place them on a map we prepared for you so you can see how they behave.

In the next lesson, we’ll start by prototyping interactions between physics nodes.

Locating the Lesson Files

To get started, open the project “Learn to Code with Godot: Practices” in Godot and, in the FileSystem dock, expand the TowerDefense directory. We will create a scene together. See you in the lesson!