Silly Question
gariantroll
Member Posts: 219
How do I put in an animation with a key press? The problem is my animation only plays when the input is held down from the keypad. I just want the input to be pressed and not held down and the animation to play once. How do I accomplish this? Thanks for helping me.
Comments
in the key Actor create a [Rule] when key is down changeAttribute [exp] game.keyPressed To: true
in your animation Actor create a [Rule] when keyPressed = true
do the animation
to free things up:
time the animation and drag in a Timer and set After to that animation time and drag in change.Attribute to change keyPressed to false.
MH
When Key is Down
--Change Attribute self.animate to true
When Attribute self.animate equals true
--animate
then since i'm assuming you want to be able to replay the animation with more key presses.
find the image name of the last frame of your animation and add one more rule
When Attribute self.image equals imagename.png
--Change Attribute self.animate to false
You could also try using an otherwise in the first rule to change attribute back to false but that may kill your animation just like you released the key.
Good Luck
so many ways to skin this cat!
MH
I'm not a fan of the GS timers. I've had them act real funny on me. If I cant use interpolate for the timer I usually will look for another way before that freaking timer.
I will try this out.
Also keep in mind you may need to combine both ways since mine is based on a keyboard key and motherhoose's is based on an actor button on screen. that will determine wether you want to create a game attribute or self attribute. if you plan on making an iphone game I would go ahead and create it as a game attribute and put the key rule inside you button actor. then you have keyboard button assigned to do the same as on onscreen button and it make testing more realistic.