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
34,371
Reaction score
8,778
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
34,371
Reaction score
8,778
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

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,986
Reaction score
2,304
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
 

Latest Threads

Latest Profile Posts

7DcJlIG.png


Made a lot of progress on the tileset for the more sumptuous interior areas for the priory
I keep thinking up of new changes or improvements... Edit: Forgot to add the image Gimpwork.JPG
Hello, my nickname is Rigomor, but I am also known as Mopsikus. I work on RPG Maker games, and are currently working on a game called Peony of War.

Forum statistics

Threads
117,301
Messages
1,106,315
Members
153,488
Latest member
AlexFliv0
Top