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?
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.
Thanks, I’ll take a look.