# Fast Key Pressing Game (Help Please)

**URL:** https://forum.kirupa.com/t/fast-key-pressing-game-help-please/1719
**Category:** flash
**Created:** [June 4, 2002, 12:23pm UTC](https://forum.kirupa.com/t/fast-key-pressing-game-help-please/1719 "2002-06-04T12:23:20Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [June 4, 2002, 12:23pm UTC](https://forum.kirupa.com/t/fast-key-pressing-game-help-please/1719/1 "2002-06-04T12:23:20Z")

</div>

Hello there, (if anyone can help me then it is you guys) can someone please help me here with my idea of a game (that I’m going to explain here) Here’s an overview of what I’ll be using:

1. Flash MX

As for the game idea:

The aim of the game is to press a key (or just the mouse button over a particular spot) as fast as you can in order to see what will happen next (there is already an animation playing even before you start pressing the key or mouse) but the challenge is the computer is also “pressing” a key and is racing you to the total required. If you win, you go to a particular end cinema, and also if you lose to the computer.

ex.  
Total needed = 1000  
1 click or press = 100  
computerclickrate = 1 every 2 seconds.  
userclickrate = depends on how fast you press or click

You click or press a key 10 times in less than 20 seconds. This makes you win (given the case in our example) and in effect, this gives you your Winning End screen (or if I want to make the game longer, I’ll just give the total needed a new value).

If you fail to press it 10 times in less than 20 seconds then you lose, and you go to the Losing End screen.

Anyway, here are some more conditions I don’t exactly know how to implement using flash.

a. The Computer assesses your clicking or pressing rate. If you are 10 clicks/presses faster than it, then it would adjust its clicking rate to 1 click faster than yours. If you are not 10 clicks/presses faster than it’s clicking or pressing rate, then it won’t change its clicking rate.

* * *

So that’s the general idea of the game. So to sum it up, I want your help to make a game that tries to beat the players clicking speed by adjusting its own rate, then upon reaching a total value (either by you or the computer) a specific animation plays.

Just in case you want to know how I picture the game in my mind:

A. Animation of 2 guys fighting it out.

B. If you are clicking faster than the computer’s clicking rate, then the animation to play is the one where your character is beating up the computer’s character.

C. If the computer’s clicking rate is faster than yours then the animation played is the one where the computer is beating up your character.

D. If the total is reached, then a specific animation will play, THEN a new higher total is set, and the computer’s clicking rate becomes 1.5 times faster than the value it had before. Also, new fighting animations replace the previous ones.

Well, thanks for your time guys, I really hope you could help me out with this project of mine=)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [June 4, 2002, 1:55pm UTC](https://forum.kirupa.com/t/fast-key-pressing-game-help-please/1719/2 "2002-06-04T13:55:47Z")

</div>

You mean… Something like this ?? 😃

pom 0]

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [June 4, 2002, 1:58pm UTC](https://forum.kirupa.com/t/fast-key-pressing-game-help-please/1719/3 "2002-06-04T13:58:17Z")

</div>

You can get it here : [membres.lycos.fr/museebra…ckRate.fla](http://membres.lycos.fr/museebranly/flash/clickRate.fla)

The principle is easy : You increment the number of clicks onMouseDown, you get the time elapsed since the beginning, and you divide one by the other.

```auto
  _root.onLoad = function () {
        nbClick = 0 ;
        rate = 0 ;
}

_root.onMouseDown = function () {
        nbClick ++ ;
        this.onEnterFrame = function () {
                time = getTimer () ;
                now = (time - start)/1000 ;
                rate = Math.round(nbClick/now*100)/100 ;
                pressRate = rate + " clicks ps" ;
        }
}

```

pressRate is my textbox. And I initialize the variable ‘start’ with the button.

pom 0]

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [June 5, 2002, 11:11am UTC](https://forum.kirupa.com/t/fast-key-pressing-game-help-please/1719/4 "2002-06-05T11:11:35Z")

</div>

Your post is very helpful! Thanks again, maybe I’ll show you later on what the output will look like hehehe… thanks again and have a fun time…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [June 5, 2002, 11:16am UTC](https://forum.kirupa.com/t/fast-key-pressing-game-help-please/1719/5 "2002-06-05T11:16:04Z")

</div>

well I’ve been wondering about how we can make it in flash mx so that when my rate is faster than the computer’s current rate, the computer will adjust so that it will beat the user’s clicking rate? Thanks again…

\*I’m just wondering if we can actually use if-then statements here in flash, as well as other styles… hmmm

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [June 5, 2002, 3:27pm UTC](https://forum.kirupa.com/t/fast-key-pressing-game-help-please/1719/6 "2002-06-05T15:27:58Z")

</div>

Create a textbox named compRate and then add this code at the end of the previous one :

```auto
   if (rate>compRate) compRate += 0.1 ;

```

pom 0]

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [June 5, 2002, 3:35pm UTC](https://forum.kirupa.com/t/fast-key-pressing-game-help-please/1719/7 "2002-06-05T15:35:10Z")

</div>

Should give something like this :

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [June 6, 2002, 4:57am UTC](https://forum.kirupa.com/t/fast-key-pressing-game-help-please/1719/8 "2002-06-06T04:57:09Z")

</div>

Hey thanks a lot for the tip… now I can continue on my happy coding lol… have a nice time.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [June 6, 2002, 6:46am UTC](https://forum.kirupa.com/t/fast-key-pressing-game-help-please/1719/9 "2002-06-06T06:46:03Z")

</div>

Hi again… now I’ve been trying to implement a timer countdown in the game. I tried setting a variable in it, then adding a “gtout --” (gtout is the name of my timer)  
but it quickly becomes a negative number.

1. I need to make it count down 1 number every second (like one round lasts for 5 seconds, I want to see the 5 seconds slowly count down while I’m mashing on the clickable button to raise my click rate).

Then after the timer reaches zero, I’ll play a new animation showing who gets hurt, then the timer will reset back to 5 seconds and we continue playing.

Thanks again in advance…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [June 6, 2002, 9:15am UTC](https://forum.kirupa.com/t/fast-key-pressing-game-help-please/1719/10 "2002-06-06T09:15:13Z")

</div>

Check this, it might help you… [pub40.ezboard.com/fkirupa…=837.topic](http://pub40.ezboard.com/fkirupafrm19.showMessage?topicID=837.topic)

pom 0]

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [June 6, 2002, 10:55am UTC](https://forum.kirupa.com/t/fast-key-pressing-game-help-please/1719/11 "2002-06-06T10:55:45Z")

</div>

I’ve finally gotten it lol! Thanks for the help heheh…
