HOW TO CHECK IF A KEY IS BEING HELD DOWN?

Posts

Pages: first prev 123 next last
It still doesn't work. The "Defend" variable stays at 2, so nothing even gets added to the release counter. This is the core problem.

And yes I had tried setting "Defend" to 0 before the key input, didn't work either.
maybe the problem is how you have the event set up.

it's hard to really grasp what is happening without seeing a video or having the project to play with, but you've got a key input process in the middle of a chain. once the key input is run, it has 2 branches after it. but then after that, the chain of code keeps going and it doesn't loop back to check the key input and branches again. so maybe that's why it's not resetting. it seems to move onto checking for a win, lose, or draw and only loops back at the bottom if you press 7.

what you should do is break up the event in phases. is that a common event or a map event? if it's a map event you can use variables and pages. the part where you need to hold the button should be on it's own page and contain only the key input and branches. it would also contain cherry's solution. that way it can loop the necessary parts and only move onto the next phase when it's supposed to. so if the player lets go, or that part of the event is over, it would move onto the next page and check for win/lose/draw and finish the event.

that is what i think, but without really understanding what you are trying to do i can only guess.
I posted a video before in the screenshot topic, I think.

Anyway, it's a common event. And indeed, there's WAY too much shit going on in one event, I noticed that a while ago.

The thing is, I have no idea how I can break this up right now and still have it working.
k, well post the vid here too.

you can still break it up with variables and branches, or even just labels probably. it's not really "too much" in one event but with stuff like this you need to loop part of it. you could probably put a jump to label 4 in there somewhere. it would have to include cherry's solution with an escape of the loop.

label 4
check key input
\if 2 do whatever

start cherry's solution by setting a new variable

if new variable is 3 jump to label 5
\else jump to label 4

label 5

something like that. roughly. i think. but like i said before i don't quite understand your goal heh

you could also start over now that you know what the problem is. try coming at it from a different direction.


Hell no I'm starting over, lol. This thing has taken too much time already, I don't want to spend much more on it.
i hope you figure a way to make that look more randomized. it looks pretty boring when most of the time the same rolls are side by side. i get that its just a test but i really hope there will be more to that.

but uh, what part of that requires you to hold down a button? that vid doesn't really help me understand this problem.

did you try the things i mentioned?

and also, does this really need to be a hold key function. why can't you just press the button once and have the player defend for a short time? or have the player press another key to leave defend position?
I don't know, you tell me. How can I make it look more randomized then Rm2k3 picking a random number between 1 and 3? I realize the same rolls are often side-by-side, but how can I fix that, it's completely random. Pure coincedence.

The part that requires you to hold a button is when the pictures stop moving. If you lost the roll, that bird dude will attack with a hammer and you'll lose a point. But, if you hold down the left arrow key, you'll raise your shield and block the attack, not losing any points.

I could do that, press the button once and defend for some time. But that could make it too easy and too annoying. What if the guy suddenly stopped defending right before getting hit? Sure, I could program it in that he doesn't stop defending until the attack is over. But I want there to be a chance to screw up. You gotta hold that button if you wanna survive, otherwise you get smacked. Having the player press a button and sit back and watch an automatic win is not something I'd like to do.
@JustRob

For visual purposes, I would dramatically speed up the roll and maybe have the dice spin in opposite directions. You could also have 2k3 pick random between more scenarios than 3. Say 1-9, where 1-3 makes it spin around once before stopping on R,P,S, 4-6 makes it spin twice, etc, etc. I mean personally, I'd probably spend some effort to randomize it 20+ variations.

You really need to separate the Defending part from the rolling the dice part. At a glance, your defense code isn't getting cycled during the "LOSS" phase. It's a one time event that if you didn't have the key held down when it comes up, it won't activate afterwards.

If the rolling the dice coding is working, just remove the key input defend code from the "LOSS" branch. Instead, put it in a separate parallel process and include Cherry's cycle fail safe.

If you only want to be ALLOWED to defend when you lose a roll, have the "LOSS" branch of the main event activate a switch which turns on the defense process. And turn that switch off before the next roll.

Or if you really want it all to be in one event, then you're going to have to throw in some labels to have this stuff cycle like Link said. It's honestly not too much stuff for one event at all. I'd only separate for ease of use.

I know starting over would be a pain, but honestly if your stuff isn't working, you just have to rethink it. Your game doesn't look particularly complicated, and separating elements might even give you room to add more features or twists to the RPS.
author=Sauce
@JustRob

For visual purposes, I would dramatically speed up the roll and maybe have the dice spin in opposite directions. You could also have 2k3 pick random between more scenarios than 3. Say 1-9, where 1-3 makes it spin around once before stopping on R,P,S, 4-6 makes it spin twice, etc, etc. I mean personally, I'd probably spend some effort to randomize it 20+ variations.

You really need to separate the Defending part from the rolling the dice part. At a glance, your defense code isn't getting cycled during the "LOSS" phase. It's a one time event that if you didn't have the key held down when it comes up, it won't activate afterwards.

If the rolling the dice coding is working, just remove the key input defend code from the "LOSS" branch. Instead, put it in a separate parallel process and include Cherry's cycle fail safe.

If you only want to be ALLOWED to defend when you lose a roll, have the "LOSS" branch of the main event activate a switch which turns on the defense process. And turn that switch off before the next roll.

Or if you really want it all to be in one event, then you're going to have to throw in some labels to have this stuff cycle like Link said. It's honestly not too much stuff for one event at all. I'd only separate for ease of use.

I know starting over would be a pain, but honestly if your stuff isn't working, you just have to rethink it. Your game doesn't look particularly complicated, and separating elements might even give you room to add more features or twists to the RPS.


I honestly don't see the point in that. You could make it spin a hundred more times, in the end it's still going to choose 1 2 or 3. There are three choices. Making it spin once or twice more is not randomizing, it's just visual appeal.
author=JustRob
I honestly don't see the point in that. You could make it spin a hundred more times, in the end it's still going to choose 1 2 or 3. There are three choices. Making it spin once or twice more is not randomizing, it's just visual appeal.

This is why:

author=Link_2112
i hope you figure a way to make that look more randomized. it looks pretty boring when most of the time the same rolls are side by side.

As in make it LOOK more randomized. Vary the spinning visuals. Obviously there's only 3 possibles results. When I make a minigame with a succeed/fail, I usually put in several different versions of the success and the fail, so you don't see the same thing over and over again, despite the fact that the result is the same.

I mean, you asked this yourself:

author=JustRob
I don't know, you tell me. How can I make it look more randomized then Rm2k3 picking a random number between 1 and 3? I realize the same rolls are often side-by-side, but how can I fix that, it's completely random. Pure coincedence.

Say you roll paper and the enemy rolls paper. If you have variations, they won't spin identically like each other. They'll end up both as paper, but while you're staring at the spinning dice, you won't know until they stop.

Anyway, the more important part is getting the thing to work.
Well, I did as you said and put the Defend code in a separate event. I also implemented Cherry's fix. And while the "Defend" counter is set to 0 as soon as the key is released, the picture still does not change back from "defend state" to "idle state".

I can't see from here, but as a quick troubleshoot, is the key input option "wait until pressed" checked on? It needs to be OFF, or unchecked.

(I don't want to insult you in case you already know this, but I want to clarify that if you check the "wait until pressed" the event will stop right there. Unchecked, the event keeps going and identifies whether the key is being held when the key input process line occurs. This is the version you need for your game, so it cycles continually. They're basically two totally different types of input.)

Also put the wait 0.0 outside the conditional, by itself at the end.

Another possible trouble area would be the pictures itself.
Like A) the picture 7 you're showing isn't working
Or B) there's something elsewhere that's overwriting the picture 7 with it's own show picture
Oh, right. I left that on by mistake.

Now it works, perfectly. I can't believe it. Yay!
Hi guys, I have another question regarding to this minigame:

Is there a way to check how long it takes until the player presses a button? See, in this Rock Paper Scissors game I want to implement a system where, if the player wins the roll, he has to attack the enemy in order to score a point. But he has to attack immediately after winning the roll, because if he waits one second (or half a second) the enemy will raise his shield and the attack will fail.

So if the player doesn't press the attack button one second after winning the roll, the enemy pulls up a shield. How would I go about that?
Just increment another variable, +1 for each Wait 0.0, then you get the time in 1/60 seconds.
Well, I tried but I'm still having some troubles.

I didn't insert any waits, because if I do, if the player pressed the attack button nothing happens for a while and then after a few seconds the attack is shown. But, even though I set the "enemy defend" to 300 or over, the counter shoots up to that amount almost immediately, making the attack always fail.

I need some way to, let's say, have a variable add 1 value for every second that transpires, but without holding up other processes.

Of course, because you need to count this variable at the beginning or end of your parallel process, not in a loop (the only thing in this loop is incrementing the variable, so the loop CAN'T exit before the variable has reached 300).
Can someone help me with a bug?

So now, I have the player event, which sets up the pictures at the beginning and controls the player's spinner.



In the instances where the player wins the roll, I turn on the switch "Attacking Enabled", which triggers this event:



However, when I win a roll and I press the right arrow key (the key for attacking), it shows the attack animation in a weird flickering sort of way, and it keeps immediately going back to the player's idle pose.

Strange enough, the enemy's animation (the bird) does play correctly without any flickering or resets. I can't figure out what's wrong.
Pages: first prev 123 next last