1
TiledSprite가 예상대로 작동하지 않는 것 같습니다. 설명서가 없으며 AndEngineExamples의 예제는 도움이되지 않습니다. TiledSprite가 예상대로 작동하지 않습니다.
이 코드를 고려 는@Override
public void onLoadResources() {
BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
mBlockAtlas = new BitmapTextureAtlas(512, 512, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
mBlockTexture = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(mBlockAtlas, getApplicationContext(), "num_plasma.png", 0, 0, 3, 3);
getTextureManager().loadTexture(mBlockAtlas);
}
이것은 내가했습니다 512 × 512 텍스처로드 - 수동 - 단지 테스트 목적으로 3 × 3 타일로 나누었다.
public Scene onLoadScene() {
mScene = new Scene();
mScene.setBackground(new ColorBackground(0.5f, 0.1f, 0.6f));
TiledSprite foo, foo2;
foo = new TiledSprite(0, 0, mBlockTexture);
foo.setCurrentTileIndex(1);
foo2 = new TiledSprite(0, 200, mBlockTexture);
foo2.setCurrentTileIndex(5);
mScene.attachChild(foo);
mScene.attachChild(foo2);
return mScene;
}
이것은 (예상대로) 화면에 두 개의 스프라이트를두고 있지만, 모두 동일한 타일을 보여줍니다 (5) : 자, 이렇게!
동일한 텍스처를 사용하지만 다른 타일을 보여주는 스프라이트가있는 경우 어떻게해야합니까?
감사처럼, 당신은 deepCopy()는 스프라이트를 만들고있는 텍스처에 필요가 있다고 생각합니다. 60 개 이상의 스프라이트에 deepCopy()를 사용하면 많은 메모리가 필요하므로 TextureRegionFactory.extractFromTexture()를 사용하려고 생각하고 있지만 그 메서드는 텍스처를 원하고 텍스처는 TextureRegion입니다. 이 작품을 만드는 방법에 대한 단서가 있습니까? – bos
TextureRegionFactory를 사용하지 않았지만 TextureRegion이 getTexture()에 대한 getter가있는 BaseTextureRegion을 확장합니다. – jmroyalty
정말 시간을 절약 할 수 있습니다. 감사! – bos