Input .keyPressed "LEFT" ... how to use directional pads with MV?

craenk22

Villager
Member
Joined
Mar 23, 2015
Messages
33
Reaction score
0
First Language
German
Primarily Uses
Well I'm not native to scripting in the first place, but I don't get anywhere with searching for my exact problem:

Player touches Object continuously while pressing any arrow key.
-> A Picture is telling the Player that he's touching the object.
.... PROBLEM: the Maker thinks, I'm touching it over and over again (pressing LEFT, break Left, break Left) and not the left button being pressed!

I heard of the option [...]

if(Input.keyPressed(" any key ")){
$gameSwitches.setValue( any value, true);
}

[...] to make this work... but it doesn't work with arrow keys.. correct?

I'm using the Keyboard Plugin : https://rpgmakermv.co/resources/keyboard-plugin.143/
for this and it works with every Key except of the arrow buttons.
What can I do about that?

And is there any other simpler solution for this?

Thanks in advance and have a nice weekend!
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,241
Reaction score
6,784
First Language
German
Primarily Uses
RMMV
Can you please tell us what you want to do instead of how you want to do it?
There are several known workarounds for different usages, but we need to know what you want to do to point you to the correct workaround.
(the description of what should have nothing to do with coding, but tell what the player will see as the final result)
 

craenk22

Villager
Member
Joined
Mar 23, 2015
Messages
33
Reaction score
0
First Language
German
Primarily Uses
sure thanks!

Conditional Branch : When Switch "you can lift objects now" is ON
& "When you walk towards the objects you want to lift" (ergo. the mentioned problem)
-> Show Picture 01 : "You can lift this Object!"

+
Conditional Branch : When pressing button Q
-> Common Call : Lift Object
-> Erase Picture 01
................................
which is no problem.



I repeat again.
If the Event is set to "if touched by player" then the picture will be shown but it is still shown,
even if I'm not touching the object.
So something like : "If you walk continuously in front of the object" -> picture will be shown. If not- then it won't be" would be perfect to know.

Is it understandable now?
I'm sorry if some of my words don't make any sense
 

craenk22

Villager
Member
Joined
Mar 23, 2015
Messages
33
Reaction score
0
First Language
German
Primarily Uses
ok found a solution.
Parallel Process knowing that the object got touched.
then if player is facing down and press left,right,or up, the picture gets erased -> parallel process stops.

simple ;)
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,241
Reaction score
6,784
First Language
German
Primarily Uses
RMMV
I think yes, even if you still used code instead of a description - and if I understand what you want, you used one of the worst ways possible to make it happen.

If you want to move an event under the condition that the player walks into it and presses a button, then a much better way is to do it like this:

1) event set on player touch to be triggered when the player moves into it.
2) conditional branch "button pressed" to check if there is a button pressed in the exact moment the player moves into the event (and not everytime like it would happen with a parallal, that would cause too much lag.

If you want the object only movable if a switch is on, use a multipage event with a condition instead of a conditional branch - that way you can also mark movable events with a different sprite when they're movable, no need for a picture. But even if you want a picture, it is better integrated into the structure I described than the way you did it.

[dpost]craenk22[/dpost]
If you have to add something and your own post is the last, edit it instead of adding a new post.
 

craenk22

Villager
Member
Joined
Mar 23, 2015
Messages
33
Reaction score
0
First Language
German
Primarily Uses
I think yes, even if you still used code instead of a description - and if I understand what you want, you used one of the worst ways possible to make it happen.

If you want to move an event under the condition that the player walks into it and presses a button, then a much better way is to do it like this:

1) event set on player touch to be triggered when the player moves into it.
2) conditional branch "button pressed" to check if there is a button pressed in the exact moment the player moves into the event (and not everytime like it would happen with a parallal, that would cause too much lag.

If you want the object only movable if a switch is on, use a multipage event with a condition instead of a conditional branch - that way you can also mark movable events with a different sprite when they're movable, no need for a picture. But even if you want a picture, it is better integrated into the structure I described than the way you did it.

[dpost]craenk22[/dpost]
If you have to add something and your own post is the last, edit it instead of adding a new post.
well no, you didn't understand what I wanted to do. But that's fine. I solved the problem myself already and I'm happy with what I've done there.

alright, sorry for double posting! won't happen again!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

I keep trying to explain to clients that the huddle masses behind the old K-Mart are a Fallout Reenactment group. Somehow I don't think they believe me. :LZSskeptic:
Hey people! What do you think about a core plugin? This will save some lines of code that I repeatedly use in all my plugins...
Wondering if I should make my enemies scale in my non-linear rpg. I'm leaning towards yes, but I don't want to use Yanfly's plugin...
French folk trying to pronounce English words. I loved how the man pronounced squirrel as 'square friend'.
Therapist: any questions? Me: Yeah, are there actually people who think Hotel California is about drugs and not fame or are people just trying to upset me?
Therapist: They WHAT?

Forum statistics

Threads
94,592
Messages
922,149
Members
124,462
Latest member
souldoood
Top