AndEngine获取错误:提供的pTextureAtlasSource不得超过Texture的边界

Uma*_*shi 4 android andengine

即时通讯新手Android游戏并启动andengine并面临问题,同时使用createTiledFromAsset代码,我的问题是

@Override
public void onLoadResources() {
    mBitmapTextureAtlas = new BitmapTextureAtlas(128, 128,
            TextureOptions.BILINEAR);

    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");

    mPlayerTextureRegion = BitmapTextureAtlasTextureRegionFactory
            .createTiledFromAsset(this.mBitmapTextureAtlas, this,
                    "move.png", 0, 0, 10, 1);
    mEngine.getTextureManager().loadTexture(mBitmapTextureAtlas);

}

@Override
public Scene onLoadScene() {
    mEngine.registerUpdateHandler(new FPSLogger());

    mMainScene = new Scene();
    mMainScene
            .setBackground(new ColorBackground(0.09804f, 0.6274f, 0.8784f));

    player = new AnimatedSprite(0, 0, mPlayerTextureRegion);

    mMainScene.attachChild(player);
    return mMainScene;
}
Run Code Online (Sandbox Code Playgroud)

我没有得到错误,因为我的BitmapTextureAtlas是128*128并且来自createTiledFromAsset的每个平铺部分应该是78*85,因为传递给它的参数是1行10列,我的源图像是779*85,这意味着什么时候宽度平铺为10个部分,然后779/10 = 78个近似,这将是每个平铺部分的宽度,因为行是1所以85/1 = 85因此每个平铺部分的宽度*高度将被放置在BitmapTextureAtlas上是78*85而BitmapTextureAtlas本身的大小是128*128那么为什么错误说Supplied pTextureAtlasSource must not exceed bounds of Texture 这里发生了什么...?或者我不了解实际的功能......?如果我错了那么createTiledFromAsset的过程如何工作........?

Hay*_*man 5

我也发现了同样的问题.我正在使用大型精灵表,并尝试使用它.在搜索之后,我在本教程中找到了一些线索:开始使用图像并且我意识到宽度和高度的值用于:

BitmapTextureAtlas(WIDTH, HEIGHT ,TextureOptions.BILINEAR);

必须高于图像大小.例如,如果我使用1200*100精灵表,我必须使用高于1200*100的宽度和高度.

BitmapTextureAtlas(2047, 128, TextureOptions.BILINEAR);