button tap
Grolarbear
Member Posts: 50
I am working no a platformer game that has a character that holds a sword. I have a button set up so that when it is pressed it changes a game boolean attribute to true. The boolean attribute attack is only true when the button is held down. This makes it so that you can hold down the button for the whole game and have attack be true. Is there any way to set it so that when you tap the button it runs the animation fully and you have to press it again to make him attack, so you arent able to hold it down for the entirety of the game?
Comments
Change your rule condition to "When touch is pressed". Put a timer in your rule set it to For 0.3 sec and check run to completion. Put your animation in here and below it add a Change Attribute action and reset your boolean to false.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
Thanks a lot colander this helped. The problem I have though is that when you put the animate function in the button actor it animates the button. Is there any way to have the button press rule make the actor animate both directions?
@colander
Ok I was thinking the button and hero were the same thing. Sometimes I don't take the time to think it through when it is not in front of me.
Just create a rule in the actor you want the animation to run in and use the boolean as the rule condition. Move animation and the change attribute for the boolean from the timer into the new rule and delete the timer from the button. In the button put a change attribute and change the boolean to true.
That should work if it won't run you may have to put your animation in a timer with run to completion checked or put the change attribute in a timer to delay it resetting. Experiment with it hopefully I thought it through a bit better this time.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
Thanks, I just had to add a timer into the rule that you said and it worked like a charm. Thanks for all the help.