Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by SlinkyDinky

Is there a way to run an animation once during a button press? I tried the following without luck...

if(ig.input.pressed('shoot'){
    this.currentAnim = this.anims.shoot;
    if(this.currentAnim.loopCount > 1){
        this.currentAnim = this.anims.idle;
    }
}

This animation runs, but is reset to 'idle' before it finishes...

EDIT - Found this: http://impactjs.com/forums/help/waiting-for-animation-to-finish/page/1, which mindblowingly is exactly the same enquiry.

1 decade ago by drhayes

Your edit makes it sound like you figured it out, but JIC:

Doing...

this.currentAnim = this.anims.shoot.rewind();

...in your code and doing:

this.addAnim('shoot', 0.2, [0,1,2,3,4,5], true);

...in your init should get you there.

1 decade ago by SlinkyDinky

I had sorta figured it out (not really), but was sidetracked by some other stuff. Much appreciated.
Page 1 of 1
« first « previous next › last »