Animation Finished

Get help using Construct 2

Post » Wed Jan 04, 2012 5:15 pm

I cant get the Animation finished to work... What am I doing wrong...


Global Set a_Mode=0

Group OPENBAY
--System Trigger once
System a_Mode = 0    
----Sprite set animation to "Open"
----Sprite start animation from beginning
--Sprite On Animation "Open" Finished
----System Set a_Mode to 1

Group CLOSEBAY
--System Trigger once
System a_Mode = 1    
----Sprite set animation to "Close"
----Sprite start animation from beginning
--Sprite On Animation "Close" Finished
----System Set a_Mode to 2

Here is the example:
Capx fileZetar2012-01-04 17:28:26
B
192
S
6
G
7
Posts: 213
Reputation: 10,178

Post » Wed Jan 04, 2012 5:19 pm

Oops, the problem, I guess you might want to know that...

It runs the Open animation (not set to loop) then sits there. If I put the On animation finished as a sub event of Play animation, it repetitively opens...   Strange...
B
192
S
6
G
7
Posts: 213
Reputation: 10,178

Post » Wed Jan 04, 2012 5:37 pm

What you described:


My solution:
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Wed Jan 04, 2012 6:02 pm

Thanks Kyatric! That fixed the problem. (P.S. Sorry about making you build that thing. I posted the capx, but was to late... YOUR FAST!)

Is that a Group Glitch? Or is it a issue with Animation finished... OR, did I need a Trigger once for the animation finished... (Just thinking out loud now..)
B
192
S
6
G
7
Posts: 213
Reputation: 10,178

Post » Wed Jan 04, 2012 6:31 pm

It is just a matter of how events work.

In the version as you setted it up, you set an animation to play, and then (since it was a subevent) in the same tick (and only this tick since you had Trigger once while true) you tested if the animation was finished.

Logicaly, it wasn't.

And so CloseBay actually never fired too since a_mode never went to 1.

You probably can do all this in a single group, but I respected the structure you gave at first, giving it a bit more sense with the activating/deactivating of the other group.Kyatric2012-01-04 18:31:52
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Wed Jan 04, 2012 7:22 pm

Thanks for the refresher. I needed to re-read how that works. Makes sense now
B
192
S
6
G
7
Posts: 213
Reputation: 10,178


Return to How do I....?

Who is online

Users browsing this forum: DemantDigitalArt, Google [Bot], Lancifer and 22 guests