How to make enemy for run and gun game

version 4.1

Making a run and gun game, and I need to make an enemy that can move in all directions, shoot, and take damage when shot at.

1 Like

this is quite complex, so you need to break down the enemy into its simple parts and create these parts separately.

taking damage when shot at is the easiest part right now because it just needs to react when colliding with an Area2D in the group that the bullets are in — or more specifically the player’s bullets, if you want the player to be invincible against their own bullets.

even this part needs to be broken down: you don’t want to blindly implement “taking damage” before you know that “reacting to bullets” works, so in the first iteration print_debug should be the only call when the enemy gets shot.

the “move in all directions” and “shoot” parts are much more difficult to make when you don’t know how they should behave yet. you need to answer these questions for yourself:

  • Âżhow does the enemy decide when to move and in which direction?
  • Âżhow does the enemy decide when to shoot and in which direction?
1 Like

you can take logic from this

and transfer to Godot 4 and your project requirements.


Thanks, yeah it would probably help to break down each individual attribute and move one at a time so that it doesn’t seem so daunting.

1 Like

Thanks, I’ll take a look.

1 Like