Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8335849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:47:59+00:00 2026-06-09T03:47:59+00:00

I am currently working on a save system in my XNA game that fires

  • 0

I am currently working on a save system in my XNA game that fires off an event when it’s finished saving.

My game has multiple screens which are managed by a screen manager, each screen has its own Update and Draw methods.

In the constructor, my _newSave boolean is flagged as true, this boolean starts off the game save process (which is managed by helper), and once it starts the process, it is flagged to false to prevent constant looping (since i only want to save once per save screen).

When helper is finished saving, it fires off the event, back inside the SaveScreen class, which sets _newSave back to true, and tells the ScreenManager to change screens.

Playing the game everything seems to work correctly, until the second time saving, when this save is attempted the game freezes. It is worth noting that this bool is private and only used in this method the 4 times shown (found usage by visual studio to confirm)

class SaveScreen : LoadingScreen
{
    private bool _newSave;
    private Player _player;

    public SaveScreen(EventHandler screenEvent, ContentManager Content, GraphicsDevice GraphicsDevice, Player player)
        : base(screenEvent, Content, GraphicsDevice)
    {
        screenTexture = Content.Load<Texture2D>("saving");
        _newSave = true;
        this._player = player;
        helper.FinishedSaving = new EventHandler(FinishedSaving);
    }

    public override void Update(GameTime gameTime)
    {
        if (_newSave)
        {
            helper.RequestSave(_player);
            _newSave = false;
        }

        helper.UpdateSaving();

        base.Update(gameTime);
    }

    private void FinishedSaving(object o, EventArgs e)
    {
        _newSave = true;
        screenEvent.Invoke(this, new EventArgs());
    }
}

With a breakpoint inside the FinishedSaving event, i confirmed that the bool is changing to true, which is correct, however, a following breakpoint on the next save cycle on the if statement, shows that bool is false.

I am so completely confused by this, as the only _newSave = false statement is inside the if statement that needs to be true to access, the breakpoint inside the event shows that it is true, yet on the first “new” loop of the update code, it is false.

I am really pulling my hair out with this and cannot understand what’s happening.

Any help is hugely appreciated, and i’m sorry if it’s something silly, i’m a relatively new programmer 🙂

Thank You! <3

EDIT: Pastebin of entire Helper.cs class: http://pastebin.com/uJ0g6e00

Loading Screen Class: pastebin.com/8W8HxBnq

Screen Class: pastebin.com/qr29gzuq

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T03:48:02+00:00Added an answer on June 9, 2026 at 3:48 am

    I figured out the problem, apologies to everyone for wasting their time, and thank you for trying to help, turns out that simply switching the _newSave; = false and helper.RequestSave(_player); statements around fixed the issue, I thought that the problem was isolated into this class alone due it being the only place where the changes happened, in fact the issue was that i invoked the delegate inside the RequestSave method when the player score was not greater than the high score, this caused the code to then return to the if block and since the “_newSave = false;” statement was directly after the method call, it was reverting the statement back to false!

    So silly of me but sometimes it’s really hard to see the simple problems 😛 Thank you again!

    <3

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im currently working on a game that uses multi touch to apply zoom to
So i am currently working on a simple game project that most people start
I am currently working on an iPhone app which uses CoreData to save some
Currently working with converting SQLException error messages into messages that are more useful for
Am currently working on an application that requires users to submit posts and comments
I'm currently working on implementing a logging system for a new Hadoop cluster I've
I am currently working on a WPF/.Net project, In this project the user has
I'm working on an inherited system which has some design issues which OO Buzzwords
I am currently working with multi-lingual site. In some cases i need to save
I'm currently working on a simple wxPython app that's essentially document based. So far

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.