0

I'm developping a game which implements gif sprites... After start with gif I used png image and for change the TextureRegion of my sprite I followed this guide: Sprite.setImage() in andengine and it worked very well.

Now I want to do the same thing with AnimatedSprite. Can someone tell me How i can edit the org.anddev.andengine.entity.sprite.AnimatedSprite.java to create:

sprite.setAnimatedTextureRegion(PixelPerfectTiledTextureRegion textureRegion)

P.S I use also PixelPerfect

4

1 回答 1

1

The AnimatedSprite class uses the same texture region declared in BaseSprite, so the code in the link you gave will work - just paste it in the AnimatedSprite.java file:

public void setTiledTextureRegion(TiledTextureRegion textureRegion) {
    this.mTextureRegion = textureRegion;
}

Note: If the different tiled textures have different number of tiles (So each has a different animation parameters associated with it) you should handle it in your code. It may get complicated, so I'd just create a new AnimatedSprite instead of replacing the texture region.

于 2012-12-09T00:19:28.900 回答