Cleaning up shop and object hierarchies
We are going to start this chapter off by preparing our codebase. During the course of this chapter we are going to be adding new objects to the game scene, such as power ups, particle effects, and destructible objects that we need to behave much in the same way as obstacles and coins currently do. As our current class hierarchy has our ACoin
object inheriting from AObstacle
, we have begun an inheritance chain that will lead to many development headaches. Now is a good time for us to right this with a quick fix, and construct a much smarter and cleaner object hierarchy.
When creating object hierarchies, we should ask ourselves, what functionality will be shared among all objects in the hierarchy? Any functionality you can think of that would adhere to this question should be included in the base object. Currently, most of our base functionality is present in the AObstacle
object. This process will be removing a large amount of functionality from this...