Scripting enemy movement and behavior in a top-down shooter

I've decided to quit trying to find a decent tutorial and just make a game. I've decided on a simple 2d vertical shmup with one stage that lasts forever. The longer the game is played, more difficult enemies that fire more and more bullets will appear. The goal is to survive as long as possible and get the highest score. I've done the design for player and enemy scenes and I know how I would handle a very simple enemy (i.e. fly in from outside the screen, move to a point at the screen and just keep shooting at the player). However, I'm wondering how to implement more complex movement patterns and behaviors. If all the enemy has to do is just move, then I know I could use a PathFollow2D to make the enemy move along the path and then have it freed when it goes off the screen. Is there a way to associate extra information along the points on a path that would tell the enemy to slow down/speed up or fire bullet(s) when it reaches that point? If not, how would I be able to do that?

There are some other things I've designed that I'm not too sure about either. I plan on creating a BulletSpawner scene that is able to spawn a single bullet of different types with the given velocity, direction, and possibly acceleration. Then I will create different scenes inheriting from a BulletPattern node that can handle more complex patterns, like n-way bullets, random directions, velocities, and danmaku-like patterns that can fill the screen. An enemy would then have one or more BulletPattern nodes as a child, which it interacts with by calling a method to tell it to start/stop firing. Would this be an alright way to do this? I am a complete beginner to game development and the tutorials only cover the easy stuff (like how to get a sprite moving on the screen).

I plan on giving the player a limited set of bombs they can use to clear the screen of bullets and damage enemies. To clear the screen, would the easiest way would be to put all the enemy bullets in a group and then use that to free them when the bomb is activated? I could probably handle the damage in a similar way, although I might just use an Area2D around the player that sits on the player bullet layer and use that to damage enemies.

As a software developer I'm used to reading about design patterns (not just in OOP, there are functional and procedural patterns too) and software engineering (all the steps you need to do before you put down a single line of code, as well as maintaining code). I wish there was something like this for Godot and game development in general.


Tags :

Answers

  • flurickflurick Posts: 18Member

    Well to answer one of your questions, you could just check the offset on the pathfollow agains some list of patterns.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file