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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:04:46+00:00 2026-05-13T20:04:46+00:00

Hey, I am making a frogger type game and I am using a timer

  • 0

Hey, I am making a frogger type game and I am using a timer to make the images move across the screen. I am also using the keydown event to handle when the user moves the ‘frog’. So, w moved up, s moves down etc.

The problem I have come across is that whenever the user presses any movement button, the timer freezes. This means if the user just holds down ‘w’ or up, all the cars stop moving.

Is there a way of putting the timer in a background worker or a way to make the timer carry on ticking even when the user is moving?

Thanks for any help!

This is what I currently have:

    public string i;
    private void Form1_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.KeyValue == 68)
        {
            i = "right";
            backgroundWorker1.RunWorkerAsync();
        }
    }


private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
    {
        if (i == "right")
        {
            pictureBox1.Location = new Point((pictureBox1.Location.X + 17), pictureBox1.Location.Y);
        }
     }
  • 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-05-13T20:04:47+00:00Added an answer on May 13, 2026 at 8:04 pm

    Look at the Output window when you run your program with the debugger. You’ll see lots of IllegalOperationException messages. The background worker method is dying on an exception, you are not noticing it because you don’t check the e.Error property in a DoWorkCompleted event handler. That’s why it ain’t moving.

    You are not allowed to set the properties of a control in a background thread. That’s what the exception is trying to tell you. You’ll need to give up on the idea of using threads to implement your UI logic. Games are usually implemented with a game loop.

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

Sidebar

Related Questions

Hey so i'm making a simple text game using the pdCurses library and a
Hey, I'm making a simple user friendly css editor using Prototype. Anyway, I was
Hey guys I am making a terminal application using Swing and Apache Commons. I
Hey guys I am making a 2D game and I have generating a random
Hey guys i'm making my first game in c++ and I was wondering how
Hey, i am making a survey using AJAX to send the votes. what below
Hey i am making a app in which i want to make emulator that
Hey guys im making a c++ game and im trying to load a bitmap
Hey guy's im making a 2D java game and i want to learn how
Hey guy's i'm making a Paddle/Pong game and right now i'm trying to find

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.