I’d like to build an engine in XNA, primarily for a 2D RPG. At first, I began abstracting out some classes and built a Sprite class which wrapped a Vector2 and a Texture2D, and tried loading in content from the Sprite class’ constructor. However, this didn’t work. Now, it appears that I have to load all of the sprites within the Game class’ LoadContent method. Is there anyway around this? I’d like to separate the actual Game Content from the inner workings of the engine, if possible.
Share
Yes, you can pass the
ContentManageras a parameter to yourconstructorso you can use this in your class. e.g.