This is the first of a number of tutorials that will guide you through the development of a complete, full-featured game engine.
If you’ve been following the tutorials up to this point, you’ll have a sprite that you can move around the screen using the keyboard. While this is a good start; we will, in the not too distant future, want to add additional functionality to our player object. At the very least we will want our player to have health, physics, a bounding box for collisions, and a way to animate its sprites. This is where the component system comes in, the focus of todays and next weeks tutorial.
In this tutorial we will re-implement the movement code that we previously used to move our sprite around the screen, but this time as a component. We’ll also create a transform component that will be attached to all of our games objects. This component will store the sprites position, rotation, and scale (although it will only store its position initially).
As games become more complex, the issue of how to manage a games assets and resources is only becoming more difficult; which is why, even though we do not have many resources at the moment, it is a good idea to start the groundwork on what will become a robust and generic (it can handle any resource we throw at it) resource management system.