Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8423237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:40:20+00:00 2026-06-10T03:40:20+00:00

I have an isometric .TMX file created with Tiled, I’m using AndEngine GLES1. I

  • 0

I have an isometric .TMX file created with “Tiled”, I’m using AndEngine GLES1. I want to use it as a background or map. I also want to have my “players” movement tied to the tiles if possible. I know that there are some questions dealing with this, but I need the actual code just to display the background.

Here is my only java file

package com.example.game;

 import java.util.LinkedList;

 import org.anddev.andengine.engine.Engine;
 import org.anddev.andengine.engine.camera.Camera;
import org.anddev.andengine.engine.options.EngineOptions;
import org.anddev.andengine.engine.options.EngineOptions.ScreenOrientation;
import org.anddev.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
import org.anddev.andengine.entity.modifier.MoveModifier;
import org.anddev.andengine.entity.scene.Scene;
import org.anddev.andengine.entity.scene.Scene.IOnSceneTouchListener;
import org.anddev.andengine.entity.scene.background.ColorBackground;
import org.anddev.andengine.entity.sprite.Sprite;
import org.anddev.andengine.entity.util.FPSLogger;
  import org.anddev.andengine.input.touch.TouchEvent;
import org.anddev.andengine.opengl.texture.TextureOptions;
import org.anddev.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
import org.anddev.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
 import org.anddev.andengine.opengl.texture.region.TextureRegion;
 import org.anddev.andengine.ui.activity.BaseGameActivity;

 import android.view.Display;

 public class SimpleGame extends BaseGameActivity implements
IOnSceneTouchListener {
//Set up camera
private Camera mCamera;

//Set main scene
private Scene mMainScene;
//?? graphics variables?
private BitmapTextureAtlas mBitmapTextureAtlas;
private TextureRegion mPlayerTextureRegion;
//declaring sprite variable for player character
private Sprite player;
//Equiping ammunition
private LinkedList projectileLL;
private LinkedList projectilesToBeAdded;
private TextureRegion mProjectileTextureRegion;


@Override
public Engine onLoadEngine() {
    //Preparing Engine giving it proper resolution (what you see on the screen)
    final Display display = getWindowManager().getDefaultDisplay();
    int cameraWidth = display.getWidth();
    int cameraHeight = display.getHeight();

     mCamera = new Camera(0, 0, cameraWidth, cameraHeight);

    return new Engine(new EngineOptions(true, ScreenOrientation.LANDSCAPE,
    new RatioResolutionPolicy(cameraWidth, cameraHeight), mCamera));
}

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

    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
    // assinging the player.png image for the mPlayerTextureRegion
    mPlayerTextureRegion = BitmapTextureAtlasTextureRegionFactory
        .createFromAsset(this.mBitmapTextureAtlas, this, "player.png",
        0, 0);
    mEngine.getTextureManager().loadTexture(mBitmapTextureAtlas);

    mProjectileTextureRegion = BitmapTextureAtlasTextureRegionFactory
        .createFromAsset(this.mBitmapTextureAtlas, this,
        "Projectile.png", 64, 0);
}

@Override
public Scene onLoadScene() {
    //??? Creating the scene?
    mEngine.registerUpdateHandler(new FPSLogger());

    mMainScene = new Scene();

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

    final int PlayerX = this.mPlayerTextureRegion.getWidth() / 2;
    final int PlayerY = (int) ((mCamera.getHeight() - mPlayerTextureRegion
            .getHeight()) / 2);

    // Using sprite to illustrate player
    player = new Sprite(PlayerX, PlayerY, mPlayerTextureRegion);
    // Place player on game screen
    mMainScene.attachChild(player);

    projectileLL = new LinkedList();
    projectilesToBeAdded = new LinkedList();

    mMainScene.setOnSceneTouchListener(this);

    return mMainScene;
}
     // This method is used for shooting "bullets"
    // Need to find a way to limit ammunition based on in game inventory
      private void shootProjectile(final float pX, final float pY) {

int offX = (int) (pX - player.getX());
int offY = (int) (pY - player.getY());
if (offX <= 0)
    return;

//Using projectile.png as sprite, what is .deepCopy???
final Sprite projectile;
projectile = new Sprite(player.getX(), player.getY(),
mProjectileTextureRegion.deepCopy());
mMainScene.attachChild(projectile, 1);

int realX = (int) (mCamera.getWidth() + projectile.getWidth() / 2.0f);
float ratio = (float) offY / (float) offX;
int realY = (int) ((realX * ratio) + projectile.getY());

int offRealX = (int) (realX - projectile.getX());
int offRealY = (int) (realY - projectile.getY());
float length = (float) Math.sqrt((offRealX * offRealX)
        + (offRealY * offRealY));
float velocity = 480.0f / 1.0f; // 480 pixels per 1 sec//
float realMoveDuration = length / velocity;

MoveModifier mod = new MoveModifier(realMoveDuration,
projectile.getX(), realX, projectile.getY(), realY);
projectile.registerEntityModifier(mod.deepCopy());

projectilesToBeAdded.add(projectile);
    }

public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {

    if (pSceneTouchEvent.getAction() == TouchEvent.ACTION_DOWN) {
        final float touchX = pSceneTouchEvent.getX();
        final float touchY = pSceneTouchEvent.getY();
        shootProjectile(touchX, touchY);
        return true;
    }
return false;
}


@Override
public void onLoadComplete() {


}
    }

EDIT
After switching to GLES2 this is giving me some errors. I’m using a new class and inserting the provided code. Do I need to create classes for any of these? Is linking the TMXproject done via properties – android and the “add” box at the bottom of that page?? Thanks

package com.example.game;

import org.andengine.engine.camera.Camera;
import org.andengine.engine.options.EngineOptions;
import org.andengine.engine.options.ScreenOrientation;
import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.scene.background.Background;
import org.andengine.opengl.texture.TextureOptions;
import org.andengine.ui.activity.SimpleBaseGameActivity;
import org.andengine.util.debug.Debug;

public class StarterGame extends SimpleBaseGameActivity {

static final int CAMERA_WIDTH = 800;
static final int CAMERA_HEIGHT = 480;
private Object tiledMap;

@Override
public EngineOptions onCreateEngineOptions() {
    //Create view for the scene??
    Camera mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
    return new EngineOptions(true, ScreenOrientation.LANDSCAPE_SENSOR,
            new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), mCamera);
}

@Override
protected void onCreateResources() {
    // TODO Auto-generated method stub
    try {
        final TMXLoader tmxLoader = new TMXLoader(context.getAssets(), textureManager, TextureOptions.NEAREST, vertexBufferObjectManager, new ITMXTilePropertiesListener() {
            @Override
            public void onTMXTileWithPropertiesCreated(final TMXTiledMap pTMXTiledMap, final TMXLayer pTMXLayer, final TMXTile pTMXTile, final TMXProperties<TMXTileProperty> pTMXTileProperties) {
                    // do stuff with tiles that have properties...
            }
        });
        this.tiledMap = tmxLoader.loadFromAsset("tmx/bg.tmx");
          this.tiledMap.setIsometricDrawMethod(TMXIsometricConstants.DRAW_METHOD_ISOMETRIC_CULLING_PADDING);
    } catch (final TMXLoadException e) {
            Debug.e(e);
    }
}

@Override
protected Scene onCreateScene() {
    //Setup scene with background color only
    Scene scene = new Scene();
    scene.setBackground(new Background(0.09804f, 0.6274f, 0));
    return scene;
}

    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:40:21+00:00Added an answer on June 10, 2026 at 3:40 am

    Unfortunately I can only show you how I do it with the AndEngine GLES2. I am not sure though, that this is possible with the GLES1 Version. But maybe you can try an tell us about your experience.

    first download the TMX Tilemap Extension from the Git repository: https://github.com/nicolasgramlich/AndEngineTMXTiledMapExtension

    second link your project with the AndEngineTMXTiledMapExtension Project (it needs to be marked as a Library)

    When these two projects are linked you can actually use the Extension like this:

     import org.andengine.extension.tmx.TMXLayer;
     import org.andengine.extension.tmx.TMXLoader;
     import org.andengine.extension.tmx.TMXLoader.ITMXTilePropertiesListener;
     import org.andengine.extension.tmx.TMXProperties;
     import org.andengine.extension.tmx.TMXTile;
     import org.andengine.extension.tmx.TMXTileProperty;
     import org.andengine.extension.tmx.TMXTiledMap;
     import org.andengine.extension.tmx.util.constants.TMXIsometricConstants;
     import org.andengine.extension.tmx.util.exception.TMXLoadException;
    
    
     public class YourActivity extends SimpleBaseGameActivity {
         private TMXTiledMap tiledMap;
         private TMXLayer tmxLayer;
    
         @Override
         protected void onCreateResources() {
           try {
               final TMXLoader tmxLoader = new TMXLoader(getAssets(), getTextureManager(), TextureOptions.NEAREST, getVertexBufferObjectManager(), new ITMXTilePropertiesListener() {
                @Override
                public void onTMXTileWithPropertiesCreated(final TMXTiledMap tmxTiledMap, final TMXLayer tmxLayer, final TMXTile tmxTile, final TMXProperties<TMXTileProperty> tmxTileProperties) {
                        // do stuff with tiles that have properties...
                }
               });
               this.tiledMap = tmxLoader.loadFromAsset("tmx/yourMap.tmx");
               this.tiledMap.setIsometricDrawMethod(TMXIsometricConstants.DRAW_METHOD_ISOMETRIC_CULLING_PADDING);
           } catch (final TMXLoadException e) {
                Debug.e(e);
           }
    
         }
    
         @Override
         protected Scene onCreateScene() {
               this.tmxLayer = this.tiledMap.getTMXLayers().get(0);  // the 0 is just an index of the layer. It depends on how many layers you created within Tiled
               attachChild(this.tmxLayer);
         }
    
     }
    

    When you included your isometric map you may see some pixel artifacts (black lines, where the tiles come together) – its a common problem and there is a fix for it at:
    http://code.google.com/p/andenginetmxtiledmapartifactfixer/
    here you find a java program with which you can load your map file and that will produce a fixed map that you can use in your project. Look under usage to see which parameters you need.

    hope this helps anyway 🙂

    christoph

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
I'm using tiled to create a tile map. (Tiled is a tile map editor
I have an isometric map which I draw to the canvas. When I try
I have a basic isometric map with some sprites loaded on the map in
Say you've got a tile image that you use to build an isometric map.
In my isometric flash game I have some models with long shadows. I want
Have an app that can use tts to read text messages. It can also
Is there a simple way to have isometric projection? I mean the true isometric
My problem is I Have an isometric grid, just based on the X,Y values:
I really have an issue with mouseclicks in an isometric view. Simply i have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.