>how do you generate a dynamic number of enemies? The factory pattern helps a lot.
Why?
The factory pattern is about adding logic and state to the creation of objects. What's wrong with creating enemies using their usual constructors and dumping them into a resizable array?
You use a factory when you have code that needs to create something but shouldn't determine the details of their creation. If you want to create enemies from multiple places (seems common) you don't want to have to refactor every place when you change something about the creation or pooling.
Yes, if you determine that creating your objects requires passing in state or using some logic that you don't want to put in the constructor, then using a factory or factory function makes sense. However that has nothing to do with creating a dynamic number of enemies.
Why?
The factory pattern is about adding logic and state to the creation of objects. What's wrong with creating enemies using their usual constructors and dumping them into a resizable array?