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

1 decade ago by Eddie

I tried looking for an answer to this question around the forums and couldn't find one, so here goes:

The Entity class is designed so that your init: function contains the addAnim functions in it. These addAnim functions ask you to specify a "Frame Time" as the second parameter, which is how long a specific sprite is in place throughout the run-through of the animation. However, in order to make a sprite with a good running animation, the "Frame Time" has to change according to the Entity's speed (i.e. when your first starting to run the sequence of sprites is slow and starts speeding up to simulate running faster and faster).

However, since addAnim is in the init: function, it doesn&039;t get updated. Should I move the #addAnim to the update function and add a variable to the FrameTime? I feel like this would break my game. If this isn't the solution, what is?

Thanks fellow Impact users.

1 decade ago by OMATASE

you could always adjust the frame speed of the current animation in place in your update override.

// untested
this.currentAnim.frameTime = .03; // or whatever new value you'd like

or a specific animation

// also untested = .03; // or whatever new value you'd like

1 decade ago by Eddie

Yup, I actually tried this right before reading your answer and it works, thanks!

My follow up problem is that I set it up like this:

		    // Animation Control
                if( this.vel.y < 0 ) { // If the player is jumping
		    	this.currentAnim = this.anims.jump;
		else if( this.vel.y > 0 ) { // If the player is falling
		    	this.currentAnim = this.anims.falling;
	  	else if( this.vel.x != 0 ) { // Else if the player is moving left/right
			this.currentAnim =;
			if (this.vel.x < 50 && this.vel.x > -50) { = 0.5;
			else if (this.vel.x < 100 && this.vel.x > -100) { = 0.3;
			else { = 0.2;
       		else { // Else they must be idle
        		this.currentAnim = this.anims.idle;

However, it's kind of odd and not smooth. It bugs out a little bit. Better suggestions for this?

You can check out the game to see what I mean:

1 decade ago by Eddie

Nevermind guys! All fixed. It seems that everytime I flipped the Entity, I needed to rewind the animation, that was causing some weird glitches.
Page 1 of 1
« first « previous next › last »