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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:26:05+00:00 2026-06-14T08:26:05+00:00

My current score output is ‘SCORE: 0’ written twice (one in red letters the

  • 0

My current score output is ‘SCORE: 0’ written twice (one in red letters the other in yellow) in the upper left corner of the screen but with slightly different positions to give the letters/numbers a retro overlapping look. Only one score, but two layers of the same score.

The problem is that only the red layer of the score updates while the yellow layer stays at 0.

I am creating two objects of my ScoreFont class in a FontManager class (see below) with different colors/positions to give that overlapping feel (yellow on red) with the following code;

fontList.Add(new ScoreFont(Game.Content.Load<SpriteFont>(@"Fonts\Score"), scoreText, new Vector2 (5, -5), Color.Yellow, 1f, 0f));
//Adding this to make the score font stick out more by layering it
fontList.Add(new ScoreFont(Game.Content.Load<SpriteFont>(@"Fonts\Score"), scoreText, new Vector2(9, -5), Color.Red, 1f, 0.1f));

You’ll notice that the first ScoreFont object created is the yellow one (the one I”m trying to fix), the second being red (the one displaying the correct score). If I reversed these then the yellow would work but the red would not.

I am updating/drawing the list in the FontManager class with a for loop;

for (int i = 0; i < fontList.Count; i++)
        {
            Font f = fontList[i];
            f.Draw/Update(gameTime, sB);
        }

The ScoreFont.cs class which is derived from the Font.cs class contains;

class ScoreFont : Font
{
public string scoreText;
public int totalScore = 0;

public static ScoreFont sF;
//Constructor
public ScoreFont(parameters)
:base (parameters)
{sF = this;}

//Add score
public void AddScore(int score)
{
    totalScore += score;
}
//Draw
public override void Draw(GameTime g, SpriteBatch s)
{
scoreText = "Score: " + totalScore;
s.DrawString(scoreText,blah, blah, ...);
}

And I am updating the score by calling the AddScore method in a different class when the sprites go off the screen via;

ScoreFont.sF.AddScore(spriteList[i].score);

This works great if I’m only creating one layer of the score but when I try to create two, the top most layer (the yellow one) doesn’t update.

How do I fix this?

  • 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-14T08:26:06+00:00Added an answer on June 14, 2026 at 8:26 am

    Beside the very awkward use of the Font class, your problem is in:

    ScoreFont.sF.AddScore(spriteList[i].score);
    

    Why aren’t you looping in all your fontList item to set each of them with the new score value?

    foreach(ScoreFont font in fontList)
        font.AddScore(myScore);
    

    You implement a singleton pattern with the static field name sF but somehow you have multiple instances to update.

    Or, if your plan was to have only a single score, then the AddScore and the totalScore field should also have been static.

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

Sidebar

Related Questions

Current Array Output: [0] => Array ( [id] => 165 <-- first occurrence [score]
One of the data structures in my current project requires that I store lists
Need to process files in current directory one at a time. I am looking
This is my current $_POST output. Array ( [fullname] => John Doe [email] =>
Here's my current code , and here's my current output: This program will calculate
I'm taking HTML file and one XSLT file as input and generating HTML output
I want to store the current date & time which can be get by
I need to be able to store the current height and width of a
I have been reviewing the setup of a current Amazon Web Store implementation to
HttpContext.Current.Items is a store that has a life span of the HTTP request. I'd

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.