1

I was adding animation to the game, i added my images in a array[] of TextureRegion and added the key frames and duration to Animation().

I have set the play-mode to NORMAL.

But when i am doing this:

if(Gdx.input.isTouched())
    {  
        batch.begin();
        readyText_elapsedTime += Gdx.graphics.getDeltaTime();
        batch.draw(anim.getKeyFrame(readyText_elapsedTime, false), 5, 20);
        batch.end();
    }

The Result is that i am getting the animation, but if the click is too fast, some of the frames are preloaded and the animation gets completed earlier. What might be the solution to this?

Umit Kaya
  • 5,771
  • 3
  • 38
  • 52
ManishSB
  • 767
  • 9
  • 27

1 Answers1

1

And as i cant comment yet, i ask here to make your question a bit clearer.

For your animation you can set the speed - when you create a new animation: new Animation(float frameDuration, TextureRegion... keyFrames), change the frameDuration to adjust your speed.

Also i can advise you to use TexturePacker with TextureAtlas for your animation keyframes, not to add all by hand to an array. About this check out my answer on this question

Community
  • 1
  • 1
lxknvlk
  • 2,744
  • 1
  • 27
  • 32
  • Yeah i have used TextureAtlas for keyframes, and i have keyframes upto 41,i am giving frame duration of 1/10f, But too i am not getting the required result – ManishSB Aug 18 '14 at 15:14
  • I also needed animations like dart wheel game's 1.dart throw and 2.dart fall,also!! – ManishSB Aug 18 '14 at 15:15
  • If you need your animation to be faster you can make the duration of keyframes 1/15f or less. Doesnt that solve your problem? – lxknvlk Aug 18 '14 at 17:42