0

I've been trying to create a class that mimics the AndEngine TMXTiledMapExample and I cannot get my simple class to load a TMXTiledMap from my assets. Can someone help me understand what's going on? I've set up my asset base path and almost duplicated the TMXTiledMapExample.

@Override
protected void onCreateResources() {
    //page 28
    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");


    mBitmapTextureAtlas = new BitmapTextureAtlas(getTextureManager(),  512, 1024,  TextureOptions.DEFAULT);
    this.playerTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(mBitmapTextureAtlas, this, "Boost.png", 100, 100);
    mBitmapTextureAtlas.load();

}

@Override
protected Scene onCreateScene() {
    this.mEngine.registerUpdateHandler(new FPSLogger());
    final Scene scene = new Scene();

    //Create tmxLoader with internal listener that can listen for properties of tiles (such as collisions, item pickups etc.)
    try{

        final TMXLoader tmxLoader = new TMXLoader(this.getAssets(), this.mEngine.getTextureManager(), TextureOptions.BILINEAR_PREMULTIPLYALPHA, this.getVertexBufferObjectManager());

        //Get instance of the map   
        this.mTMXTiledMap = tmxLoader.loadFromAsset("level1.tmx");



    }catch(final TMXException tmxe){
        Debug.e(tmxe);
    }

Error message: 03-13 23:49:11.057: E/AndEngine(27801): AndEngine 03-13 23:49:11.057: E/AndEngine(27801): atorg.andengine.extension.tmx.TMXLoader.loadFromAsset(TMXLoader.java:104)

  • I had issues with setAssetBasePath not working while loading fonts - just for grins - try it without using the call to setAssetBasePath and explicitly set the path for the file and see if that works. – jmroyalty Mar 14 '14 at 09:53
  • after explicitly loading from the path it still doesn't work. I'm not very familiar with the target API's and related components of android projects that I should be using, could it be a more fundamental problem related to this? – esmurphy Mar 17 '14 at 04:32

0 Answers0