Object generation from an existing object in a game engine
To simplify, let's say in en engine I'm coding for a game, I have the Main class an Object class. In the Main class' update method, I loop through the array of all Objects in the game. I also have a pool in the Main class from where I can get and return Objects.
Main.update () { for (all Objects) { Object[i].update() } }
My question is what's a good way of creating new Objects from an existing object's update method?
Do I have to pass the Main class to the Objects? or make the Main a static class?
Also another question is how to handle object destruction where I return them to the unused pool.
Thanks in advanced.
To simplify, let's say in en engine I'm coding for a game, I have the Main class an Object class. In the Main class' update method, I loop through the array of all Objects in the game. I also have a pool in the Main class from where I can get and return Objects.
Main.update () { for (all Objects) { Object[i].update() } }
My question is what's a good way of creating new Objects from an existing object's update method?
Do I have to pass the Main class to the Objects? or make the Main a static class?
Also another question is how to handle object destruction where I return them to the unused pool.
Thanks in advanced.
No comments:
Post a Comment