What You Just Did
Stop right here and give yourself a nice, hefty pat on the back. Solid software design is hard to master. Far too many developers dive into code without thinking ahead, and the result is a mass of spaghetti code that quickly becomes unmanageable. Let's review what you've done here:
You created an inheritance hierarchy for sprites, including a base class handling animation and two derived classes handling user input and automated movement.
You learned about
GameComponents, which can be used to create a modular design of interchangeable components.You created a
SpriteManagerclass that handles updating and drawing of sprites as well as checking for collisions.You cleaned up the
Game1class to facilitate future development in coming chapters.