AndEngine downloads TMX map on multiple devices
I have a problem with my game. I have a 1280x1280px map. It consists of 40x40 tiles, so 1 tile is 32x32 pixels. The thing is, I cannot scale this map to the actual screen size of my device. Is there a way to do this?
This is how I load the tmx file:
public Scene onLoadScene() {
// TODO Auto-generated method stub
this.mMainScene = new Scene(1);
try
{
final TMXLoader tmxLoader = new TMXLoader(this, this.mEngine.getTextureManager(),
TextureOptions.BILINEAR_PREMULTIPLYALPHA);
this.mTMXTiledMap = tmxLoader.loadFromAsset(this,"gfx/untitled.tmx");
//"gfx/0_fire_drill-lvl_01.tmx"
}
catch(final TMXLoadException tmxle)
{
Debug.e(tmxle);
}
for(TMXLayer tmxLayer : this.mTMXTiledMap.getTMXLayers())
{
this.mMainScene.getChild(0).attachChild(tmxLayer);
}
return this.mMainScene;
}
This is what the point looks like: http://postimage.org/image/403w3dfnx/
Actions will only be performed in the red area. Do I need to draw a map?
Thank you in advance!
source to share
The problem is not with how you create the map, but with your camera. Create a camera using one of the different AndEngine camera classes. (I'm a fan of SmoothCamera.) Like this:
SmoothCamera camera = new SmoothCamera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT, 10, 10, 1.0f);
CAMERA_WIDTH and CAMERA_HEIGHT are for definition. If you set them to lower values, you will be increased more. You can also directly adjust the zoom to the camera. Like this:
camera.setZoomFactor(5.0f);
And you probably want to set up a camera to haunt your player essence. Something like that:
camera.setChaseEntity(pChaseEntity)
Where pChaseEntity is what you need. Hope this helps.
source to share