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 John

Never mind, I fixed it by cutting down the animations to a single frame

this.addAnim( 'up1', .7, [9] );

      this.addAnim( 'up2', .7, [10] );

      this.addAnim( 'up3', .7, [11] );
      
      this.addAnim( 'down1', .7, [0] );

      this.addAnim( 'down2', .7, [1] );

      this.addAnim( 'down3', .7, [2] );
      
      this.addAnim( 'left1', .7, [3] );

      this.addAnim( 'left2', .7, [4] );

      this.addAnim( 'left3', .7, [5] );
      
      this.addAnim( 'right1', .7, [6] );

      this.addAnim( 'right2', .7, [7] );

      this.addAnim( 'right3', .7, [8] );
      
      this.addAnim( 'idleup', 0.1, [10] );
      
      this.addAnim( 'idledown', 0.1, [1] );
      
      this.addAnim( 'idleleft', 0.1, [4] );
      
      this.addAnim( 'idleright', 0.1, [7] );

And then used the currentAnim.frame property to get the current frame and sent it to my player copy.

1 decade ago by Joncom

Maybe you're content with how it's working now, but something doesn't seem right to me looking at your code. You should be able to have a single animation for up, down, left, and right, without having to worry about anything 'freezing'.

// Assuming you want the 3-frame animation to loop continuously.
this.addAnim( 'right', .7, [6,7,8] );

1 decade ago by John

I was using that code but for some reason it was freezing on the first frame. The code above is just a work around.

1 decade ago by dominic

Did you maybe overwrite the entity&039;s #update() method and didn&039;t call #this.parent()?

The animation has to be updated for each frame - normally this is done in the parent update(). If you don&039;t want to call #this.parent() in your entity&039;s #update() for some reason, you can call this.currentAnim.update() directly to update the animation frame.

1 decade ago by John

Man I feel dumb, how did I miss that. Thanks for pointing it out.
Page 1 of 1
« first « previous next › last »