So, I have a player class with basic actions. During the gameplay he unlocks new abilities. I don't know how to store new actions within the player class. To be precise - I know how, but my method is too messy and i want to clean up code. Also, I want to add to the enemies some of those abilities. In other words, every game entity(expect walls, perhaps :D) should have a collection to which i can add methods that extend entity functionality. How do i make this? Sorry, if my question is too abstact
|
I recommend you approach used in the Artemis Entity System Framework. You can think about your player, enemy, wall etc. like about container (entity) for components. Then you precise actions (systems) for entities with particular set of components. |
|||||
|
I've received a great reply on StackOverflow This problem can be solved with dictionary and lambda functions
And add new powers to this dictionary:
Then just call whenever you want |
|||
|