How to disable temporarily movement keys (or any suggestion)

megumi014

Veteran
Veteran
Joined
Mar 8, 2017
Messages
130
Reaction score
213
First Language
Spanish
Primarily Uses
RMMV
Hi, I've been trying to create a sliding puzzle using picture movements and storing them in variables like this:

slidehelp.jpg slidepuzzlepicture.jpg

A variable stores the position of the invisible square, and if you click right/left/etc... the pictures move and the variables of the rest of the pictures are modified.

  • The problem I have is that when I click, for example, the left button and the right button at the same time, or I hold one while clicking the other, both actions happen at the same time and the puzzle glitches or moves 2 pictures at the same time. Is there any way to disable the other movement keys when clicking one of them? Like: If *left* button is pressed down, disable *right, up & down* until the variables are modified and then activate them again. Or if anyone has an idea that could help I'd gladly accept suggestions :)

Thank you for your time.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
during an autorun all player input is disabled, and if you have a check for button pressed within that autorun, it will only react to the checks you placed there (which means one after another unless you're using parallel process on different events, which would be a bad idea anyway)

For better help, we need to see the full event pages of your event (or events)
 

megumi014

Veteran
Veteran
Joined
Mar 8, 2017
Messages
130
Reaction score
213
First Language
Spanish
Primarily Uses
RMMV
during an autorun all player input is disabled, and if you have a check for button pressed within that autorun, it will only react to the checks you placed there (which means one after another unless you're using parallel process on different events, which would be a bad idea anyway)

For better help, we need to see the full event pages of your event (or events)
Sorry, I forgot to say that all of that is placed on an autorun event.

Here is the full description of the event (I didn't know if I had to explain it all or just ask the question, my bad):

First I create a variable for each piece of the puzzle, including the invisible one, in this case I made 6 (the idea is to make a bigger puzzle). Then I assign a figurative number for each XY position of the puzzle on the screen:

1 - 2 - 3
4 - 5 - 6
(the #6 is the invisible one, or No picture).​

On the first page of the event (no autorun) I show all the pictures on their respective positions: picture 1 on firstXY, picture 2 on secondXY... and then I modify their variables to the figurative number: Picture 1 = 1, Picture 2 = 2 etc. (for now the puzzle would look finished but is to explain the event better, I would change the pictures positions on this first page to disarray the puzzle randomly). Then I activate a self switch to the Page2 of the event.

SLIDE61.jpg

Then on the Page 2 I make a (very long) autorun event. I take the invisible picture (here #16) as a "pivot" to create the conditional branches, one for each position on the puzzle.

If Piece #16 is in position 1 (piece #16's variable = 1)
If Piece #16 is in position 2 (piece #16's variable = 2)
If Piece #16 is in position 3 (piece #16's variable = 3)...
If *cancel* is pressed down erase everything and switch A off.

Since I can't predict where all the pieces will be placed once the player starts moving them around I made this:

If Piece #16 is in position 1 (piece #16's variable = 1): --> upper left
If *left* button is pressed down:
If piece #11 is in position 2 (piece #11's variable = 2) --> upper middle
-Move picture #16 to picture #11's position .
-Move picture #11 to picture #16's position.
-Then set the picture #16 variable = 2, and picture #11 variable = 1.​
If piece #12 is in position 2 (piece #12's variable = 2)
-same but with picture 12...​
If piece #13 is in position 2 (piece #13's variable = 2)...
-same...
If *up* button is pressed down:
If piece #11 is in position 4 (piece #11's variable = 4) --> lower left
If piece #12 is in position 4 (piece #12's variable = 4)
If piece #13 is in position 4 (piece #13's variable = 4)...
SLIDE62.jpg

Doing this all the pictures will never have the same number on their variables at the same time, and when all of them reach a determinate combination, it would trigger a new switch to continue/erase the event:

slide 63.jpg

Right now when I tap the left, down, right or up buttons the puzzle works perfectly. The problem is when I hold the key too long and/or 2 of them are pressed at the same time: for some reason it reads both "if X button is pressed down* command, and since the pictures have a different variable number in their respective trees, 3 pictures will move instead of 2 and the modifications of the variables would also get messed up. Since I know how the event is set up I wouldn't press 2 at the same time, but I can't predict what the player would do (and if you click the keys too fast sometimes it reads 2 commands at the same time too).

I have tried with adding different waiting times but it doesn't make a difference if when I'm holding one key I press another. That is why I'd like to know if there is a way to disable temporarily those movement keys (to place it under the *if X button is pressed down* and activate it after the variable numbers are changed), or make it so the event only moves on when the key is released instead of pressed down.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
no, it doesn't read both at the same time - it reads them one after another, because the autorun will loop to the beginning (it loops once per frame, that is sixty times per second) as soon as it is completed. You need to add a wait(30) or so at the end if you want to give the player time to release it.
And what is that control self-switch B= ON intended to do? It will do nothing, because as you said yourself to go back to page 1 you need to off self.switch A, not ON to B
 

megumi014

Veteran
Veteran
Joined
Mar 8, 2017
Messages
130
Reaction score
213
First Language
Spanish
Primarily Uses
RMMV
no, it doesn't read both at the same time - it reads them one after another, because the autorun will loop to the beginning (it loops once per frame, that is sixty times per second) as soon as it is completed. You need to add a wait(30) or so at the end if you want to give the player time to release it.
And what is that control self-switch B= ON intended to do? It will do nothing, because as you said yourself to go back to page 1 you need to off self.switch A, not ON to B
Thank you! Adding waiting time didn't work, but the explanation about the looping per frame gave me the idea to isolate each position of the picture #16 with a different loop, therefore now it can't read the second button until the loop is broken and it doesn't need to read the whole page from the beginning. Now it works perfectly, thanks again :)

(yeah the switch B there didn't do anything, it is meant to activate the next event page once the puzzle is completed, the switch A off is on the cancel button part).
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,045
Members
137,569
Latest member
Shtelsky
Top