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 MrIsaacs

Hello there, i started a few days ago with imapctjs and already hitted some problems with playing some Animation.

Code:
this.anima = 1;
if(ig.input.pressed('touch')) {
	if(this.anima){
		if(this.player.currentAnim.loopCount && this.player.currentAnim == this.player.anims.idle) {
			this.player.currentAnim = this.player.anims.doSomething;
			this.anima = 0;
		}
	}
	else{
		if(this.player.currentAnim.loopCount && this.player.currentAnim == this.player.anims.doSomething) {
			this.player.currentAnim = this.player.anims.idle;
			this.anima = 1;
		}
	}
}

Now my Problem:
doSomething duration is 1 sec per frame. The first frame of doSomething sometimes plays just for a few seconds and not for the listed duration in the Animation. This is always happening when I want to change the the Animation by click to the doSomething Animation.

If i've not explained myself good enough, your pleased to ask me, because a can't get further without this.

Thank you, impactJS-Comunity
and thank you Dominic

1 decade ago by MrIsaacs

sorry for the bad thread title, my browser crashed and i didn't saw it :/

1 decade ago by Kxen

Not sure if it helps but try adding rewind() when changing animation:
this.player.currentAnim = this.player.anims.doSomething.rewind();

1 decade ago by MrIsaacs

yesss maaaaaaan!!!!! it worked very well!

thank you!
Page 1 of 1
« first « previous next › last »