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 8985235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:17:13+00:00 2026-06-15T21:17:13+00:00

Interesting problem! Basically I have a timer for my UI that counts down from

  • 0

Interesting problem! Basically I have a timer for my UI that counts down from 99. Everything works fine save for the fact its drawing the new time on top of the old time. (The previous time is not clearing) There is a clear happening within the GameplayScreens draw call though… its just weird.

Here are my related functions:

GameplayScreen.cs (or our usual Game1)

public override void Update(GameTime gameTime)
{
    m_GameUI.Update(gameTime);
    m_GameCam.lookAt(m_Hero.Position);//feeds the camera's lookAt function the players vector2 position
    m_GameUI.lookAt(m_GameCam.Position); //Look at the camera's position :D
}

public override void Draw(GameTime gameTime)
{

    ScreenManager.GraphicsDevice.Clear(ClearOptions.Target,
                                       Color.CornflowerBlue, 0, 0);

    SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

    m_BackgroundManager.Draw(spriteBatch, m_GameCam);      
    //Begin the Spritebatch Drawing
    spriteBatch.Begin(SpriteSortMode.Immediate, null,
        null,
        null,
        null,
        null, m_GameCam.ViewMatrix);

    //Call EntityManager.DrawAllEntities()
    EntityManager.Instance.DrawAllEntities(gameTime, spriteBatch);

    //End the spritebatch drawing
    spriteBatch.End();

    spriteBatch.Begin();
    m_GameUI.Draw(gameTime, spriteBatch);
    m_PlayerUI.Draw(gameTime, spriteBatch);
    spriteBatch.End();
 }

GameUI.cs

SpriteFont m_Font;
double m_Timer;

public virtual void Update(GameTime gameTime)
{

    m_Timer -= gameTime.ElapsedGameTime.TotalSeconds;

}

public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch)
{

    spriteBatch.Draw(UITexture, Position, Color.White);
    spriteBatch.DrawString(m_Font, "" + (int)m_Timer + "", new Vector2(380, 45), Color.White);
}
  • 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-15T21:17:14+00:00Added an answer on June 15, 2026 at 9:17 pm

    Ended up being a really silly mistake, I had a class deriving from the UI that was calling base.draw() so both the updated clock and the original value were being displayed on the screen at once. Basically poor code design, everyone is a newbie when they start out right?

    Thanks for looking into it 🙂

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

Sidebar

Related Questions

Interesting problem I have here, usually I just round up/down respectively for my needs
We have an interesting problem with WCF binding and streaming transfer mode that we
I have an interesting problem. The basis of the problem is that my last
I have an interesting problem that I've yet to find a proper solution to.
I am trying to solve an interesting problem. I have a table that has,
Have come against an interesting problem and I'm stumped. Basically on one of our
So I have an interesting problem that's been the fruit of lots of good
I have an interesting problem. I'd like to create a generic class that can
I have an interesting problem here... <cfloop from=1 to=#form.countField# index=i> <cfif isdefined('form[semester#i#]')> <cfquery name
I've been tasked with an interesting problem. Basically, I have to compute 3 different

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.