Original Post
Hi, I have a design problem whith objects that create other objects. For example a player that shoots bullets, should create them and add to the scene, particle emmiter should add particles and so on. The way i do this now: 1. There is a State Manager which holds State object (examples of States: game, main menu etc) 2. State holds containers with with various objects in it (enemies, bullets, player) 3. I want objects - for example particle emmiter - to be able to create objects and add them to these containers, however, emmiter itself is in one of containers so to add new object to scene it should have a reference to State object it's in. That means cyclical dependency and doesn't really look like proper design. The way i have it now is that for example, if player wants too shoot it sets some flag on, and State object checks every frame if flag is up, if so it reads info from player object and basing on that creates and adds bullet object. The problem is that now everything needs to be checked by State and it would be much more intuitive if player could spawn objects and add them to State in some easier way. Any suggestion on how to solve it? Side info: game is written in C++