Monday, 15 July 2013

How to resize animation in libgdx? -


I want to draw an animation, each frame size is 500x500px, but when I try to resize, the animation Rotates ...

Code here to create frames and create animation: Texture = new texture (Gdx.files.internal ("fire_sheet.png")) ;

Texture Ration [] FireForms = New Texture [4]; FireForms [0] = new architecture (fireshot, 0, 0, 0, 500); Firefram [1] = New Texture Desert (Fireshot, 700,01200,500); Firefram [2] = New Texture Desert (FireShare, 1450,0, 1, 150, 500); Firefram [3] = new framework (fire cooler, 2250,0, 2750,500); Fire animation = new animation (0.5f, fireframe);

In the draw method, I resize the animation like this:

  Public Zero Draw (batch batch, float parent alfa) {batch.enableBlending ( ); StateTime + = Gdx.graphics.getDeltaTime (); CurrentFrame = Assets.fireAnimation.getKeyFrame (statetime, true); Batch.rara (currentframe, getX (), getY (), 200, 200); }  

So if I use it:

  batch.drau (current frame, getX (), getY ()); // Works !!! But if I use it instead of a big 500x500px  

for me:

  batch.draw (current frame, getX (), getY () , 200, 200); // animation does not work properly  

What can I do?

Thanks in advance

Try this as a test (estimation of 500 Imposing is the size of your original texture): batch.draw (currentframe, getX (), getY (), 0, 0, 500, 500, 0.4 f, 0.4 f, 0);

Tincture of clots


No comments:

Post a Comment