Touch 1 actor multiple times
fritsengilles@gmail.com
Member Posts: 2
Hi, I'm working on my first app (for ipad) and can't seem to figure out 1 (probably simple) thing. If I want an actor to have 3 things he can do, for example; on first touch jump and land, on second touch wave arms and on the third touch to do a pirouette (all animated). The first touch i get, but what rule do I have to create so the actor goes to the second and third animation?
I hope i'm clear in my problem
Thanks a bunch
Comments
Hey there. I'm very new to this so it might be a fail on my part but I have an idea.
Try creating an attribute "step" for the actor (integer)that acts as a step counter and set it to 0.
Then if actor receives a touch and step = 0 change self. Image to the first frame of jump animation and set step to step+1.
Have a separate rule that starts the jump animation if self.image is this starting image. Finally increase step by 1 when self.image is the last frame of animation.
Do this all two more times for when step = 2 and 4 (but set step to 0 once self. Image is final frame of third animation routine)
So hopefully, an animation routine will only start if the step is 0,2 or 4 and it does them in order.
Hopefully this helps, I can imagine there's many more efficient ways but that's what I'd try.
Create attribute called game.state (number att of some sort)
The values will rotate between 0,1,2. So now create rules off of that
If you want the animations to finish before the player can trigger the next you'll want to either detect the last frame of the animation by using self.image or by using a timer that syncs with the animation length. This should control a variable such as a boolean (game.animationcomplete we'll say)
So now:
Follow us: Twitter - Website
Thanks! this helps me out a lot!
I can go on with the game now