I am having an issue with the isometric coordinates.

When I enter the coordinates (5,5), the character should be at the bottom corner of the tile, but it is at the top corner, (5,5) and (0,0) look like they have been switched :

enter image description here

With (5,5), my character goes at the top instead of being at the bottom corner :

enter image description here

(The convertToScreen method is from : Isometric rendering and picking? )

//create isometric tiles
public Vector2 convertToScreen(float x, float y, int offsetX, int offsetY)
            Vector2 screen;
            float TILE_WIDTH = 1;
            float TILE_DEPTH = 0.5f;
            //calculate the screen coordinates
            float _x =  offsetX - (y * TILE_WIDTH/2) + (x * TILE_WIDTH/2) - (TILE_WIDTH/2);
            float _y = offsetY + (y * TILE_DEPTH/2) + (x * TILE_DEPTH/2);

            screen = new Vector2(_x, _y);
            return screen;

//in the "create" method
float valueCam = 10;
    camera = new OrthographicCamera(valueCam, valueCam * (Gdx.graphics.getHeight() / (float)Gdx.graphics.getWidth()));
    camera.translate(new Vector2(0,0));

    Vector2 conv = convertToScreen(5,5, 0,0);
    myCharacter.setPosition(conv.x, conv.y);

    public void renderMap(){
        float tileWidth = 1;
        float tileHeight = 0.5f;
        for (int x = 0; x < 5; x++){
            for(int y = 5-1; y >= 0; y--){

                Vector2 v = convertToScreen(x,y, 0,0);
                float x_pos = v.x;
                float y_pos = v.y;

                //float x_pos = (x * tileWidth*0.5f ) + (y * tileWidth*0.5f);
                //float y_pos = - (x * tileHeight*0.5f) + (y * tileHeight*0.5f);

(edit: the previous issue was the offset of x-1, fixed by changing the x_pos and y_pos as shown above)

  • \$\begingroup\$ This is a little bit unclear. Is the map meant to stay in place, and the character be at the specified (x,y) position on the grid? \$\endgroup\$
    – karmington
    Commented Feb 14, 2014 at 21:01
  • \$\begingroup\$ @karmington : yes, for now the character does not move, he should be at the top/left/right/bottom corner of the map, but there is an offset. The goal is to make him walk on the map, going from one tile to another following a path. \$\endgroup\$
    – Paul
    Commented Feb 15, 2014 at 7:16
  • 1
    \$\begingroup\$ Please make the program first keep the map centered on the screen, and check the results. \$\endgroup\$
    – karmington
    Commented Feb 15, 2014 at 17:03
  • \$\begingroup\$ @karmington Thanks, you were right, the previous code added the offset, I changed the code in render map in order to use the same convertToScreen method, except (0,0) and (5,5) are still switched? The image in my edit shows the character at 5,5, at the top corner, instead of being at the bottom. \$\endgroup\$
    – Paul
    Commented Feb 16, 2014 at 5:17
  • 1
    \$\begingroup\$ Now check that the grid coordinates you assume are correct. Place the stone tile on each corner in turn, and verify that the grid coordinates are really as you imagine. I suspect the whole grid is flipped right now, and the character is actually in the 'correct' place. \$\endgroup\$
    – karmington
    Commented Feb 16, 2014 at 8:46

1 Answer 1


The centre of the screen is x_pos:0 y_pos:0.

As you draw the tiles, y positive is 'upwards' on the screen.

So the code is now functioning correctly, but your perception of the tile positions is horizontally mirrored.

  • \$\begingroup\$ Thank you, I think I actually did not see it correctly, you were right. May I ask you to have a look at another thread? I am struggling to understand the problem : gamedev.stackexchange.com/questions/70526/… \$\endgroup\$
    – Paul
    Commented Feb 16, 2014 at 11:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .