Detect when a button is released?
How do you detect when a button has been released?
For example, pressing R2 does a pull back punch anim and then releasing R2 does the punch attack anim. If you were to hold it down it would hold the pull back anim until you release R2.
I tried the following but it seemed overly complicated and has bugs...
I have a microchip that received the R2 press. That goes into a "greater than 0" calculator which goes to a counter. When the counter equals 1* it turns on a timeline with the pull back anim and when that completes it turns on a second counter which activates a single keyframe with the final pose of animation from the timeline. This is so if you hold the button it holds the pose.
*Now, when the first counter equals 1 it's also turning on another calculator that detects when R2 equals 0. When this is on and it then equals 0, the punch anim plays and should run out and revert to the default standing pose.
The problem is if you release R2 during the pull back anim timeline it will play the punch anim but also finish the pull back anim which activates the final frame pose so ultimately the character gets stuck in the pull back pose.
Hopefully that all makes sense!
So, is this an overly complicated way of detecting a button release?
And also how would I interrupt a timeline? When that second "equals 0" calc activates it triggers the power on the first timeline. But I can't tell if this is toggling the power or turning it on or off. I think what I'd like is a definite way to tell something to turn off immediately. Or on.
Any thoughts much appreciated!
-
Oops I made a small mistake! If I tap R2 it plays the punch anim on release but seems to also blend the rest of the pull back anim or that final keyframe which means the punch appears to get halfway and stop. So it's not getting stuck. If I hold R2 until that final pose then release, it will play the punch anim as intended!
-
You can use a Signal Manipulator set to Custom Remapper, then in the Edge Mode section, set it to Pulse at OFF. This will send a pulse when the signal that was produced turned off, which is what happens when releasing a button.
Hope this is useful
Pablo -
I'd like to be able to watch what happens in my microchip as I test the game too. Is that possible? Frame by frame would be even better!
-
Thanks Pablo I'll give it a try! ?
-
When I need to test logic, I set up one or more number display gadgets and wire them to the variables I want to track.
-
Regarding watching the logic while playing: In the Modes menu there's a button called Test Mode, where you can play without leaving Edit Mode, which lets you continue to watch all your gadgets and things. You may need to pin the circuit board to your screen depending what the camera does when you possess your puppet.
-
It's located here in the menus: https://indreams.me/guide/palette-glossary/assembly/modes/playtest-mode
الرجاء تسجيل الدخول لترك تعليق.