Skip to main content
Coding Quests

Godot Enemy AI

An enemy that just runs at you is not fun to fight. Every enemy here follows the same state machine and shows its attack before it lands. The player can read it and get out of the way.

Free Godot 4.7 project · MIT licensed · v1.0.0

No account needed. Or download the v1.0.0 ZIP directly.

Enemies chasing, telegraphing and attacking, with each enemy's current state written above it.

What is in it

  • One state machine for every enemy: idle, chase, telegraph, attack, recovery and dead.
  • Telegraphs you can read. A pulsing red circle or line shows where an attack will land.
  • Four behaviours: a Grunt, a weaving Skitterling, a Charger, and a boss with a slam, a projectile ring and a charge.
  • The boss enrages below half health, with faster wind-ups.
  • Knockback with hit-stun, so a hit interrupts an enemy's attack.
  • Ready to call: an elite variant, burn damage, a slow, and a spawn-in effect.

Quick start

Download the project from GitHub and unzip it. In the Godot Project Manager, click Import and pick the project.godot file inside the folder.

  1. Press F5.
  2. Move with WASD and aim with the mouse.
  3. Left click to slash, right click for a heavy attack, Space to dash.
  4. When an enemy's label says TELEGRAPH, step out of the red shape or dash through it.

The README on GitHub explains how each part works and how to copy it into your own game.

Compatibility and limits

Made for
Godot 4.7, standard build. GDScript only, no .NET needed.
Tested on
Godot 4.7.2 stable, on Windows. Earlier versions of Godot 4 are untested. Uses the Mobile renderer, which needs Vulkan, Direct3D 12 or Metal.
Renderer
Mobile
Code license
MIT. You can use it in commercial games. Read the license
Art and fonts
All sprites from Kenney's Tiny Dungeon pack (CC0 1.0).
Release
v1.0.0, commit 557b465, published 2026-10-03

Known limits

  • No pathfinding. Enemies steer straight at the player, so walls block them.
  • No line of sight. Enemies always know where the player is.
  • One player only.
  • There is no sound.

Learn to build it

Copying a system works until you need to change it. These quests build it with you, one small step at a time. You write the GDScript in your browser and each step is checked before you move on.

2D Roguelike: Enemies & AI

Builds this enemy system lesson by lesson: the shared state machine, the telegraphs, each enemy type and the boss.

First 3 lessons free

2D Roguelike: Combat Core

Builds the health, hitbox and hurtbox components these enemies use.

First 4 lessons free

See all the free Godot projectsReport a problem with this project