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

  • Home
  • SEARCH
  • 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 8193425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:28:36+00:00 2026-06-07T04:28:36+00:00

I have created a game using XNA Game Studio. It consists of a square

  • 0

I have created a game using XNA Game Studio. It consists of a square randomly moving anywhere and on clicking it, the score increases by one.

Now, what I want to do is, I want to end it after a time interval of, say, 100 seconds. So how do I do it? And where should I write that part of the code? That is, in which method? I am very new to XNA. Its just two days since I have started learning it.

  • 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-07T04:28:38+00:00Added an answer on June 7, 2026 at 4:28 am

    In your update loop check the elapsed game time greater than 100 seconds:

    int counter = 0;
    
    protected override void Update(GameTime gameTime)
    {
        counter += gameTime.ElapsedGameTime.TotalSeconds;
        if ( counter > 100 )
        {
            //end the game...
        }
    }
    

    If you want the total game time since the game started, you can use the TotalGameTime property instead, then you won’t need the counter.

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

Sidebar

Related Questions

I have created a Space Invaders Game using an example game + source. Using
I have created an animated game app, In which I am using NSTimer to
I have created a game where the user can upload their high score and
I have developed a little game using XNA 4.0 and C# (new Project->Windows Game
I have created a game for Facebook using HTML, CSS and Javascript, which is
I have created a simple game using Win32 and gdi. I would like to
I have a newly created game using Cocos2D on the iPhone. I am at
I have created a simple test game that randomly spawns icons that move around
I have just began learning Java programming, I have created a simple game using
I am writing a game which uses opengles. I have created my renderer class

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.