How do you test if no keys are being pressed?
Printable View
How do you test if no keys are being pressed?
Using the Control-X object, a negated "Repeat while any key pressed" condition will work.
Nope, it only checks the last pressed key. So if you press 2 keys and release the second it will give a false positive...
Hey, guys your still haven't helped me out. Can anybody help me please? :(
Pick a Key and Negate it. If the Key isn't pressed the condition should be true?
[color:#FF0000]X[/color] Upon Pressing "spacebar"
Do
nnnnnn
Plus tell more about what you want to do, if you can. There might be a work around.
Sorry for not being clear about it. what I want it to do is... when I press "D" I move right, and have my animation for walking, and if I'm not pressing "D" the animation gets changed or restored to the stand animation. I'm using my own movement engine.
If this is the case then can't you do what 00J suggested, but change the key?
Only One Action When Event Loops
+Repeat whilst D is pressed
- Play animation "Walking"
Only One Action When Event Loops
+[negate] Repeat whilst D is pressed
- Play animation "Stopped"
I can't remember whether "Only One Action When Event Loops" is necessary though
It is not, but it's better to include it.Quote:
Originally Posted by Raylax
I can't really see why it's better though. It's not always true that conditions eats less resources than actions.
The animation will continue itself even if the condition doesn't.
If you exclude the "Only One Action When Event Loops" the condition will repeat - which may also cause the problem of the animation continuously being sent to the 1st frame, and not just potentially reducing performance.
If the animation is already being played it won't restart. It will only change to it if something else is being played.
Okay. That's good. :)
how do u had the negate part?
Right click over the condition.
There are some options: Insert, Replace, etc. What you're looking for is 'Negate'.
It still doesn't work :cry:
Use the 'Any Key Being Pressed' condition and negate it, that should give you a positive when nothing is being pressed.