Animation Repeat Count Issue

Get help using Construct 2

Post » Thu Nov 24, 2011 6:41 pm

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.
B
31
S
10
G
7
Posts: 30
Reputation: 5,408

Post » Thu Nov 24, 2011 6:53 pm

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.
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Thu Nov 24, 2011 9:29 pm

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.



Example

Note, I only repeated it 3 times(12 frames) in my example, you will have to add the extra frames.
B
19
S
6
G
7
Posts: 1,204
Reputation: 7,296

Post » Thu Nov 24, 2011 11:21 pm

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!
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
68
S
8
G
6
Posts: 929
Reputation: 9,356

Post » Fri Nov 25, 2011 5:46 am

Thanks! That'll work!
B
31
S
10
G
7
Posts: 30
Reputation: 5,408

Post » Thu Oct 27, 2016 9:19 am

I've encountered this problem too ..
any other way to solve this beside duplicating and count it down with array ?
B
11
S
3
Posts: 6
Reputation: 691

Post » Thu Oct 27, 2016 6:41 pm

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' ?
B
16
S
10
G
17
Posts: 1,395
Reputation: 12,073


Return to How do I....?

Who is online

Users browsing this forum: Colorfish, Waltuo and 4 guests