Is there a design pattern in OOP (Java specifically) where an existing class or superclass is co-opted as part of another class to reuse some of it's functionality? The specific problem I am dealing with is I am attempting to implement cut scenes in my game. So far I have planned out that a cut scene will have actors, which will essentially be the moving elements: enemies, the player, etc. These actors will be a separate class and will need to share much of the functionality of the entities they represent, such as movement and animation, but will also need lots of other functionalities that would not fit well in the entity class itself, at least not if you adhere to OOP principles. The best way I could think to describe it is to encapsulate one class or superclass inside another, but I found it hard to find existing information on this because all I would find was information on encapsulation as an OOP concept and inner classes in Java. Any help would be greatly appreciated, including any general advice in implementing cut scenes in a self-developed game engine.
Aucun commentaire:
Enregistrer un commentaire