Animation Repeat Count Issue

0 favourites
  • 7 posts
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • Hello All,

    I have an animation that I want to repeat 5 times when a key is pressed.

    I have the animation set to Loop: No, Repeat Count: 5.

    I also do not want the player to be able to move while this animation is playing (not the issue).

    The player movement events/actions are in a group. The key for activating the animation is question is not.

    I deactivate the player movement group when the key is pressed, play the animation from begining, and activate the group when it completes.

    This works great. No issues. Until I press the animation key again. The animation only plays one time before it stops.

    My question is, why is it not taking the repeat count value into account when it is activated the second time? Is there something that needs to be reset?

    capx file link below.

    Link To File

    Thanks.

  • I was having problems with 'repeat' as well. I think I fixed it by adding "set frame to 0" and "start" each time the animation is played. I ended up making it loop and changing animations by a value, so I don't remember.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can do it this way....

    1, Increase the 'RunningMan' animation frame count to 20 (or however many times you want it to repeat) and duplicate frames 0 to 4 five times)

    2, Set repeat count to 1.

    <img src="http://dl.dropbox.com/u/22173473/runningman16.png" border="0">

    Example

    Note, I only repeated it 3 times(12 frames) in my example, you will have to add the extra frames.

  • I'm new to this, but I would have set up an array which counted down from 5. Effectively saying "If array > 0 and animation "name" is finished, set animation frame to 0" and "subtract 1 from array". You have the control lock already sorted. Of course, you will need to add the event that the array is set to 5 upon pressing the desired key which will only come into effect if array = 0.

    There's people a lot better than this than me, so there's probably a better way of doing this, but I hope I helped!

  • Thanks! That'll work!

  • I've encountered this problem too ..

    any other way to solve this beside duplicating and count it down with array ?

  • I see no issue ? As long as you dont set the 'repeat to' property.

    https://www.dropbox.com/s/cdooe1b0h4zy4 ... .capx?dl=0

    If you need the animation to end on the last frame, set that frame under the 'on animation end' ?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)