Using components in the XNA Game State Management example?

Posted by Zolomon on Game Development See other posts from Game Development or by Zolomon
Published on 2011-03-11T21:28:07Z Indexed on 2011/03/12 0:18 UTC
Read the original article Hit count: 234

Filed under:
|
|

In the game state management example at the App Hub, they say that if you want to use components in the example you can extend the GameScreen to host other components inside itself.

I'm having a very hard time trying to tie this up. I tried extending the GameScreen class by adding a public property of public List<DrawableGameCompnent> components { get; set; } and then add my components to that list when I initialize the current screen as well as looping over the components in the LoadContent, Update and Draw methods. However, this doesn't feel like the correct way to go - mainly because it doesn't work when I get to the implementation of my GameplayScreen.

Any thoughts?

© Game Development or respective owner

Related posts about XNA

Related posts about component-based