How do I ...advance one frame of animation per click?

Get help using Construct 2

Post » Wed Oct 01, 2014 4:43 pm

Hello all.

I have a strip animation that is 10 frames long. I want to click on a button and the animation advance to the next frame. So it would look like this:

Click 1 = Shows Frame 1
Click 2 = Shows Frame 2
Click 3 = Shows Frame 3
Click 4 = Shows Frame 4
...etc

I can click my button and the animation plays but but the WHOLE animation plays each time.

Any ideas?

Thanks so much.
B
15
S
2
Posts: 229
Reputation: 1,353

Post » Wed Oct 01, 2014 6:04 pm

Have you disabled the animation in the "sprite editor"?
B
8
S
1
Posts: 34
Reputation: 434

Post » Wed Oct 01, 2014 6:17 pm

set animation speed to 0
Image
B
76
S
28
G
12
Posts: 515
Reputation: 12,409

Post » Wed Oct 01, 2014 8:18 pm

Hi all,
Setting the animation to '0' appears to stop the animation altogether. Any other value just slows or speeds the animation. It doesn't actually stop at a frame. Also, I don't see in the editor where I disable the animation.
Thanks anyways.
B
15
S
2
Posts: 229
Reputation: 1,353

Post » Wed Oct 01, 2014 9:31 pm

Hello,
Set the animation speed to 0, then go into your events and go on the "On click" event and make an event for the Sprite that has these frames, and choose "Set animation frame" and when it asks you to enter a value for the frame, you will want to type in "Self.AnimationFrame+1".
That's about it :)

When it reaches its final frame (10th frame) and you click again, I think it will remain on the 10th frame. But yeah, hope this helps.
B
51
S
20
G
10
Posts: 571
Reputation: 9,819

Post » Wed Oct 01, 2014 9:55 pm

@JLH1964

I have attached a screen shot of settings / code that will work (1 line of code and example of what your animations should be set on.
You do not have the required permissions to view the files attached to this post.
B
11
S
2
G
1
Posts: 68
Reputation: 777

Post » Thu Oct 02, 2014 3:54 pm

Neller wrote:@JLH1964

I have attached a screen shot of settings / code that will work (1 line of code and example of what your animations should be set on.



That did it :) Thank you so much for the help.
B
15
S
2
Posts: 229
Reputation: 1,353


Return to How do I....?

Who is online

Users browsing this forum: ChoosyZerk, jorgmaquoi, Yahoo [Bot] and 57 guests