Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: samad.sattary on July 16, 2012, 04:21:53 PM

Title: change Idle animation when its end
Post by: samad.sattary on July 16, 2012, 04:21:53 PM
how can i change the Idle animation when its end ?
i have two idle animation i want switch them when one of them will be end

my actor is 2D!!! can i use the "IsAnimPlaying" ?
 please help me  :'(
Title: Re: change Idle animation when its end
Post by: piere on July 17, 2012, 07:53:42 PM
Instead of using a normal idle animation, try using 2 separate animation names, and you can use the same animation sprites as the idle, just name it something different so it doesn't loop.

Do this.

actor.PlayAnim("anim1");
actor.PlayAnim("anim2");

After it plays the first animation, it should jump to the second animation. Let me know if that works. Another less effective way would be to just use this.Sleep(1000); put how many seconds the first animation is then use the play command to play the second one.
Title: Re: change Idle animation when its end
Post by: Spellbreaker on July 19, 2012, 03:09:33 PM
PlayAnim is not so good in idle, because it blocks. I'd prefer to apply an event to the last animation frame in the sprite ( e.g. "changeIdleAnim" ). Then in the Actors Script you write

on "changeIdleAnim" {
this.IdleAnimName = "otherIdleAnim"
}

Of course you have to add the "otherIdleAnim" in the .actor file.

Greets,

Spellbreaker