Jump to content
  • Advertisement
Sign in to follow this  
rippingcorpse

XNA Gamestates

This topic is 4030 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, What is the easiest way to pause a gamestate when it is switched? I am making a simple menu and I would like the game gamestate to pause when the menu is activated. Thanks

Share this post


Link to post
Share on other sites
Advertisement
For some reason when I add this line of code from the previous project that was linked, I get an error saying that it must have a return type. It worked in the project I got it from, however... Anyone know what could be wrong?

public GameStateManagementGame()
{
graphics = new GraphicsDeviceManager(this);

graphics.PreferredBackBufferWidth = 853;
graphics.PreferredBackBufferHeight = 480;

// Create the screen manager component.
screenManager = new ScreenManager(this);

Components.Add(screenManager);

// Activate the first screens.
screenManager.AddScreen(new BackgroundScreen());
screenManager.AddScreen(new MainMenuScreen());
}

Share this post


Link to post
Share on other sites
Quote:
Original post by Sylvain Bories
Hello,

Is the class name the same as the class constructor (GameStateManagementGame...)? This kind of error may come from that.

Sylvain.


Nope, I used the same class names as the code in the previous link. There is no class named GameStateManagementGame.

Thanks for asking though

Share this post


Link to post
Share on other sites
Quote:
Original post by rippingcorpse
Quote:
Original post by Sylvain Bories
Hello,

Is the class name the same as the class constructor (GameStateManagementGame...)? This kind of error may come from that.

Sylvain.


Nope, I used the same class names as the code in the previous link. There is no class named GameStateManagementGame.

Thanks for asking though


Then you either need to rename it to the same name as the class it's a part of (if you wish it to be a constructor) or give it a return type (void if you don't want it to return anything).

Share this post


Link to post
Share on other sites
Quote:
Original post by rippingcorpse
public GameStateManagementGame()


Is this the constructor?

If so, then it needs to have the same name as the class.

Otheriwse, if it's just a normal method/function then it will need to have a return.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!