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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:35:02+00:00 2026-06-17T09:35:02+00:00

I am creating a whack-a-mole style game where a sum is given and numbers

  • 0

I am creating a whack-a-mole style game where a sum is given and numbers animate from the bottom of the container to the top. The aim of the game is to click the correct answer to the sum and collect as many correct answers as possible.

My problem is that the user can click the numbers and other icons multiple times, causing it to crash. Is there a way to overcome this?

I have tried this jQuery one function

$(".character").one("click", function() {
});

But the icons re-appear so I need them to be clickable again.

I have also tried to set a time out but cannot seem to get it working. Can someone point e in the right direction.

    setTimeout(function() {
    $(".character").one("click", function() {
    });
}, 3000);

Fiddle: http://jsfiddle.net/GvNB8/

  • 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-17T09:35:03+00:00Added an answer on June 17, 2026 at 9:35 am

    Your main problem is that you are not interacting with the characters when re-showing them. In that case the only way to prevent the user from clicking is building in a method to prevent clicking twice in quick succession with a timeout.

    That method would look something like this:

    function clickThrottled(fn) {
      var click = true;
      return function () {
        if(click) {
          click = false;
          fn.apply(this, arguments);
          setTimeout(function () { click = true; }, 1000);
        }
      };
    }
    

    You then use the function like this:

    $('.character').click(clickThrottled(function () {
       // do your one time magic.
    }));
    

    What I am using here is JavaScript closures. The function you pass to the click event handler will only call the underlying function once, then ignore all calls for 1 second and then re-enable itself.

    I’d still suggest you go with a normal method of just re-enabling the elements when they are redrawn onto the screen – but the above also works..

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

Sidebar

Related Questions

I am creating a whack-a-mole style game where a sum is given and numbers
I am creating a whack-a-mole style game for primary school children where they have
I am creating a whack-a-mole style educational game for children where a question is
I am creating a new whack-a-mole style game where the children have to hit
I am creating a new whack-a-mole style game where the children have to hit
Creating a simple RPG game, first time using XNA. Trying to get my character
Creating shell output for a game, but don't want the window to scroll with
Creating a Certificate authority signing request (Keychain Access, Certificate Assistant: Request Certificate from Certificate
I am attempting to take a whack at creating my first Rails application template
Creating a pacman-like game, where a player eats objects. When a MovieClip (box) eats

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.