Rapid Button Press?

yomaniac

Villager
Member
Joined
Sep 21, 2017
Messages
21
Reaction score
1
First Language
English
Primarily Uses
N/A
I am trying to make a mechanic where the player needs to rapidly press a key on the keyboard to continue the game, if they fail then it's game over. Anyone know how to do this?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,668
First Language
German
Primarily Uses
RMMV
Basically a series of conditional branches with waits, switches and variables for controlling.
The conditional branch checks if a key is pressed, but then you'll have to check if it is released again before counting - that is where you need to use switches and different nested conditional branches.
 

AdamSakuru

[Null_Value]
Veteran
Joined
Mar 14, 2014
Messages
314
Reaction score
171
First Language
English
Primarily Uses
N/A
Basically a series of conditional branches with waits, switches and variables for controlling.
The conditional branch checks if a key is pressed, but then you'll have to check if it is released again before counting - that is where you need to use switches and different nested conditional branches.
Is there a way to check specifically if a key has been released? Or would you just use a conditional branch to check if it's been pressed and then do stuff in the "Else" part of it?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,668
First Language
German
Primarily Uses
RMMV
No, that is why you need switches and a series of conditional branches.
A key has been released if it it not pressed now but was pressed previously (as stored in the switch)
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,087
Reaction score
1,508
First Language
EN
Primarily Uses
RMMZ
To elaborate...something like this:
Code:
◆Control Switches:#0001 ButtonDown = OFF
◆Control Variables:#0004 Input = 0
◆Loop
  ◆If:ButtonDown is ON
    ◆If:Button [OK] is pressed down
      ◆Comment:Nothing.
      ◆
    :Else
      ◆Comment:Button was pressed and released!
      ◆Control Switches:#0001 ButtonDown = OFF
      ◆Control Variables:#0004 Input += 1
      ◆
    :End
    ◆
  :Else
    ◆If:Button [OK] is pressed down
      ◆Comment:Button is now pressed down!
      ◆Control Switches:#0001 ButtonDown = ON
      ◆
    :End
    ◆
  :End
  ◆If:Input = 10
    ◆Break Loop
    ◆
  :Else
    ◆Wait:1 frame
    ◆
  :End
  ◆
:Repeat Above
◆Text:None, Window, Bottom
:    :You escaped! \.Congratulations!
Adding a timer to it just requires another variable (and branches) to count & check how many times the loop has run. ^_^

I happen to have a worked example, timed and with picture prompts, over on the Steam Workshop if you're interested. It's for battle skill input, but a couple of them use a "button mash" approach (the actual events don't require any plugins, don't worry). It may be a bit over-complicated for this purpose but here's a link if you're interested: https://steamcommunity.com/sharedfiles/filedetails/?id=1287577261
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,977
Members
137,563
Latest member
cexojow
Top