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,273
Reaction score
8,726
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,273
Reaction score
8,726
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,957
Reaction score
2,292
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

Just lost about half a day's worth of work because rpg maker crashed during playtesting and corrupted my file :kaolivid:
Boku.gif
advanced_puzzling.PNG
Having a lot of fun making different poses for my character sets! Open to suggestions/critique!

CSKttqh.png

AABS laser beams features:
1,Shoot penetrating laser beams for player's normal attack
2,Beam's width/damage/comsumes/loot can be controlled by events/variables with great flexibility
3,Beam can rebound to walls or certain regionID
4,Can play SE when shooting beams
5,Beam's images can be solid images or animated ones.
Surprising nobody, it turns out "next Friday" for the next Jump into Javascript has become "possibly Sunday if you're lucky" XD

Forum statistics

Threads
117,017
Messages
1,103,867
Members
152,914
Latest member
Jester926
Top