Godot RPG: Creating a New Enemy


Creating your own area is a good start to making the game your own. Even if it is a very simple test area, it will help get you started with the rest of the game, as it will define the size of your tilesets.

Creating the Scene Tree

An enemy extends entity, so you’ll need to have the basic scene tree required by the Entity Class. Names not in quotes should not be changed.

  • “Name” is type Entity
    • AnimationPlayer is type AnimationPlayer

    • Sprite is type Sprite

    • CollisionShape2D is type CollisionShape2D

    • Hitbox is type Area2D
      • CollisionShape2D is type CollisionShape2D

      • [optional] RayCast2D is type RayCast2D


Again, these are inherited from the Entity Class.

  • TYPE
    • Defaults to “ENEMY” shouldn’t need set.

    • Default is 1, can range between 0.5 and 20 and is incremental by 0.5

    • How fast the entity moves on the screen

    • The amount the entity harms an entity of a different type

    • The chance of an enemy dropping something when they die

    • Dictionary: the key is the scene path (-.tscn) to a pickup and the value is the weight of the pickup

    • This is covered more in Godot Template: Enemy Drops


You’ll need to decide if your enemy will have a very simple flip animation like the Stalfaux, something complex like the Player, or something in between.

If you plan to do complex animations for a lot of your enemmies, then it may make sense to make a “template” enemy so as to reuse all of the animations in the animation player.

A reminder on how to set up animations can be found in Godot Lesson 2: Walk and Push Animations and suggestions for basic animation spritesheets will be coming shortly.


Enemies inherit a lot of their functionality from Entity, but the basic script should include a few things.


At a minimum, _ready() should set the enemy animation.


At a minimum, it should probably look like this. Exceptions would be made for non moving enemies, enemies that don’t take damage, or other unique behaviors.

Movement and damage loops are inherited from entity. The controls loop is local.

func _physics_process(delta):


This loop determines the movement of your entity. Ideas for various movement algorithms will be documented soon.