JUSTROB'S PROFILE
JustRob
30
Search
Filter
How to check if a key is being held down?
Alright, but it's pretty damn huge lol. Well anyway here it is, the important part is marked with red.
What happens in that part is that it checks if Player's Choice is equal to 1. If it is, then player has rock. Then there's three instances for the CPU: It checks if it has 1, 2, or 3 (rock paper or scissors) and changes the result accordingly.
Now Player Choice 1 is the only one I've modified so far, in case you're wondering.
After player has gotten rock, and the player presses the left arrow (Defend), then the picture of the player changes to a defense position. If the key is released, it changes back to standing position (well, that's what's supposed to happen, and what I need help with).
As it is right now, once the left arrow key is pressed, the picture will always stay on defense position.
Picture
What happens in that part is that it checks if Player's Choice is equal to 1. If it is, then player has rock. Then there's three instances for the CPU: It checks if it has 1, 2, or 3 (rock paper or scissors) and changes the result accordingly.
Now Player Choice 1 is the only one I've modified so far, in case you're wondering.
After player has gotten rock, and the player presses the left arrow (Defend), then the picture of the player changes to a defense position. If the key is released, it changes back to standing position (well, that's what's supposed to happen, and what I need help with).
As it is right now, once the left arrow key is pressed, the picture will always stay on defense position.
Picture
The Screenshot Topic Returns
author=bulmabriefs144author=JustRobDo you always lose to scissors? It's not clear from the video.
Well, I'm glad you like it. Those scrolling symbols were an absolute nightmare...
Your Chrono Trigger map looks good, but I think the colors got a bit messed up (I don't think there was that much purple). If it's intentional, then it's actually a pretty nice edit.
No, it's completely random, which is why unfortunately there are going to be times when you lose to scissors a few times in a row, without it being intentional. It picks a random number from 1 to 3, and then moves the pictures in position according to what the result was.
The Screenshot Topic Returns
author=Xenomic
But...that's hardly enough room for anything D:
Like what? What do you need so much space for?
How to check if a key is being held down?
Yeah, I did. Unfortunately that didn't help.
I think I'll mess around with it a bit more tomorrow, and try out your advice.
I think I'll mess around with it a bit more tomorrow, and try out your advice.
The Screenshot Topic Returns
Well, I'm glad you like it. Those scrolling symbols were an absolute nightmare...
Your Chrono Trigger map looks good, but I think the colors got a bit messed up (I don't think there was that much purple). If it's intentional, then it's actually a pretty nice edit.
Your Chrono Trigger map looks good, but I think the colors got a bit messed up (I don't think there was that much purple). If it's intentional, then it's actually a pretty nice edit.
The Screenshot Topic Returns
Well, I've been experimenting with a rock paper scissors minigame for the past two weeks now, and this is the result. The idea is that the wheels start spinning, they stop randomly at rock, paper, or scissors, and then the score is compared.
Originally, I wanted to add more functionality. So that if you win a roll, you still have to press a button and actually attack the enemy in order for it to count. And if you lost a roll, you could put up a shield to protect yourself from the enemy's attack.
However, because of Rm2k3's dumb way of handling button presses and not doing what I want to, I had to give up and stop here.
Right now it's nothing more then a luck-based thing, making it useless for anything other then a minigame.
If you press shift, the wheels start spinning. If you press enter, they stop and the score is compared. If you press shift, they start again, etc etc.
Also the graphics are Marvel Land rips. I've used them as placeholders since that game is what inspired this thing.
Originally, I wanted to add more functionality. So that if you win a roll, you still have to press a button and actually attack the enemy in order for it to count. And if you lost a roll, you could put up a shield to protect yourself from the enemy's attack.
However, because of Rm2k3's dumb way of handling button presses and not doing what I want to, I had to give up and stop here.
Right now it's nothing more then a luck-based thing, making it useless for anything other then a minigame.
If you press shift, the wheels start spinning. If you press enter, they stop and the score is compared. If you press shift, they start again, etc etc.
Also the graphics are Marvel Land rips. I've used them as placeholders since that game is what inspired this thing.
How to check if a key is being held down?
Hmmm, that is weird. Where I'm using it, it does not get reset to 0. I guess the surrounding code is somehow preventing it...
How to check if a key is being held down?
See the reason this doesn't work is because once the key is pressed, the variable is set to 5 forever. Which means from that point the "else handler" is just going to get ignored.
The only way to let the game know the key is released, is to set the variable with the stored value to 0. But I don't know where to do that. I can't do it in the main part of the branch, because then as soon as the key is pressed it will think it's immediately released again. And it can't go in the else handler either, because the else handler will be ignored if the key has been pressed.
It can't go after the branch either, because then the events if the key is being pressed will just happen, and even if the player is holding the key, the value is still going to be reset to 0.
The only way to let the game know the key is released, is to set the variable with the stored value to 0. But I don't know where to do that. I can't do it in the main part of the branch, because then as soon as the key is pressed it will think it's immediately released again. And it can't go in the else handler either, because the else handler will be ignored if the key has been pressed.
It can't go after the branch either, because then the events if the key is being pressed will just happen, and even if the player is holding the key, the value is still going to be reset to 0.
How to check if a key is being held down?
You all know that in RPG Maker, if you have a key input, you store the value in a certain variable. The variable is set to the value of the key being pressed.
However, once you release the key the variable doesn't automatically reset to 0. This is problematic when designing systems where a key is being held down, because the effects of holding the button down remain even after releasing it.
So, is there a way to set the variable back to 0 if the key is not being held down?
This might actually be really simple, and I might just be missing it, and this might be a really dumb question. But I really can't think of it right now.
However, once you release the key the variable doesn't automatically reset to 0. This is problematic when designing systems where a key is being held down, because the effects of holding the button down remain even after releasing it.
So, is there a way to set the variable back to 0 if the key is not being held down?
This might actually be really simple, and I might just be missing it, and this might be a really dumb question. But I really can't think of it right now.













