为什么当我添加新敌人时,它没有动画?仅对第一个敌人进行动画处理..
private BitmapTextureAtlas EnemyTextureAtlas;
private TiledTextureRegion enemyTextureRegion;
EnemyTextureAtlas = new BitmapTextureAtlas(512, 256, TextureOptions.BILINEAR);
enemyTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(EnemyTextureAtlas, this, "enemy.png", 400, 0, 2, 2);
private void addEnemy(final float pX, final float pY)
{
final AnimatedSprite enemy;
enemy = new AnimatedSprite(pX, pY, this.enemyTextureRegion);
enemy.animate(200);
scene.attachChild(enemy);
}
最佳答案
enemy = new AnimatedSprite(pX, pY, this.enemyTextureRegion.deepCopy());
而不是
enemy = new AnimatedSprite(pX, pY, this.enemyTextureRegion.clone());
关于java - AndEngine AnimatedSprite 仅对第一个 Sprite 进行动画处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9351411/