XNA Creators Club Online
Page 1 of 1 (5 items)
Sort Posts: Previous Next

question about game components.

Last post 9/13/2008 9:44 PM by Glenn Wilson. 4 replies.
  • 9/13/2008 4:40 PM

    question about game components.

    I am working on a 2D game that will be an arcade style party game.  It will have 7-10 retro style games that will be modded to play like mini games.  I was wondering how should use game components for each mini game, and if I should how should I tell my game what component to use at what time.  (never used game components before).  I am hoping that when im done with the basics of the game I can get people to test it and see if people will have fun playing it.
  • 9/13/2008 7:51 PM In reply to

    Re: question about game components.

    I am currently working on a 2D roguelike in which all of the menuscreens and areas are inherited from : DrawableGameComponent.

    When I need to swap components I usually have an "if" statement that checks in update confirming that all the criteria for the switch have been met (fadeouts and whatnot), then something like:

    if ((gobackbool == true) && (Game.Components.Contains(titlecomponent) == false))

    {

    titlecomponent = new Title(Game);

    Game.Components.Add(titlecomponent);

    Game.Components.Remove(this);

    }

    Title is the class : DrawableGameComponent that represents my titlescreen btw, "titlecomponent" was what I called the field for Title in the current component that the code was pulled from.

    All that being said, I myself am a noob and some pro here might know a better way to handle this!

  • 9/13/2008 8:52 PM In reply to

    Re: question about game components.

    components have "enabled" and "disabled" states.

    you can create and add all components at game start, and just change the enabled state when you want a component to appear/disappear.

     

    Jon Watte, Direct3D MVP
    Tweets, occasionally
    kW X-port 3ds Max .X exporter
    kW Animation source code
  • 9/13/2008 9:03 PM In reply to

    Re: question about game components.

    Holy crap, that information is very useful to me, thank you!
  • 9/13/2008 9:44 PM In reply to

    Re: question about game components.

     

    I would also look at the performance... and i you actually do need the game components. You might find that most of the retro game you are using could use the same engine type system... and then just pass the configuration to them.

     

Page 1 of 1 (5 items) Previous Next