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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:08:28+00:00 2026-06-03T23:08:28+00:00

I have a little problem. I am working in a Title Screen or main

  • 0

I have a little problem. I am working in a Title Screen or main menu for my game. Here is a screenshot of the main window:

screenshot

and the code:

class MenuPrincipal
{
    public Texture2D Fondo { get; set; }
    public Texture2D Cursor { get; set; }

    int cambiar = 0;
    int tiempoTranscurrido;

    KeyboardState teclaActual;

    bool menuActivo;
    public bool MenuActivo 
    { 
        get { return menuActivo; } 
        set { menuActivo = value; } 
    }

    public MenuPrincipal(Texture2D fondo, Texture2D cursor)
    {
        Fondo = fondo;
        Cursor = cursor;
    }

    public void Update(GameTime gameTime)
    {
        teclaActual = Keyboard.GetState();

        tiempoTranscurrido = gameTime.ElapsedGameTime.Milliseconds;

        if (tiempoTranscurrido > 50)
        {
            tiempoTranscurrido = 0;

            if (teclaActual.IsKeyDown(Keys.Down))
            {
                if (cambiar > 2)
                    cambiar = 0;
                else
                    cambiar++;
            }
        }
     }

    public void Draw(SpriteBatch spriteBatch)
    {
        spriteBatch.Draw(Fondo, new Rectangle(0, 0, 800, 600), Color.White);

        switch(cambiar)
        {
            case 0: spriteBatch.Draw(Cursor, new Rectangle(325, 225, 16, 12), Color.White);
                    break;

            case 1: spriteBatch.Draw(Cursor, new Rectangle(325, 281, 16, 12), Color.White); 
                    break;

            case 2: spriteBatch.Draw(Cursor, new Rectangle(325, 336, 16, 12), Color.White); 
                    break;
        }
    }

}

}

I want the cursor to move from “un jugador” to “opciones,” and from “opciones” to “creditos” when the user presses the Down arrow key. However, when the user presses the Down key, the cursor moves very fast. I want a speed limit so that when I press the key one time, the cursor moves one option. If I put a “limit frame,” (variable tiempoTranscurrido), the cursor never moves. If I don’t put anything, the cursor moves very fast.

  • 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-03T23:08:29+00:00Added an answer on June 3, 2026 at 11:08 pm

    Add a flag until the key comes up, something like this…

    bool keyDown = false;
    public void Update(GameTime gameTime)
    {
        teclaActual = Keyboard.GetState();
    
        tiempoTranscurrido = gameTime.ElapsedGameTime.Milliseconds;
    
        if (tiempoTranscurrido > 50)
        {
            tiempoTranscurrido = 0;
    
            if (teclaActual.IsKeyDown(Keys.Down) && !keyDown)
            {
                keyDown = true;
                if (cambiar > 2)
                    cambiar = 0;
                else
                    cambiar++;
            }
            if (teclaActual.IsKeyUp(Keys.Down))
            {
                keyDown = false;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a little bit of a problem. I working on a project
I'm working with MT for the first time and have encountered a little problem
I'm working on a little problem. I have <li> elements and I want to
Evening :) I have a little problem... As you can see in my code
I have a little bookmarklet that opens up a new window, only problem is,
Hello i'm practising C and i have a little problem with the following code.
i have little bit of problem while working with External entity reference in External
I'm working on project with listview,but I have a little problem. I'm using SimpleAdapter
I have little problem with a replacement of a little part in an url.
I have little problem in regular expressin creation. Expected input: blahblahblah, blahblahblah, 'blahblahblah', blahblahblah,

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.