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
38,474
Reaction score
10,895
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
173
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
38,474
Reaction score
10,895
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
4,640
Reaction score
3,774
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 Posts

Latest Profile Posts

grief rpg maker... why oh why did I have to jump through like 30 hoops to (hopefully) have fixed the engine targeting ko'd people during multi hit/random attacks?
I finally finished the wrong clue death scene. So at least the player can see something cool before they get a Game Over. Prolly be less cool if they have to keep watching it repeatedly.
It's important for your party of adventurers to be harmonious and united.

unborn360.png
Me: I'm a good writer.

Also me: Creates skill, item, and equipment names like ...
Salmon Jellybean
Feel-Good Hit of the Summer
Marmalade Spreader #2
Quinoa Power!
Actual Literal Wand
Mmm Tempted so bad to get RPG maker 2000 at some point. I want to make an easter egg in my next real project, but also the allure of being a true hipster and developing in the Engine no one uses.

Forum statistics

Threads
131,707
Messages
1,222,385
Members
173,445
Latest member
romey
Top