Search Results

Search found 1 results on 1 pages for 'rawrz'.

Page 1/1 | 1 

  • Isometric - precise screen coordinates to isometric

    - by Rawrz
    I'm trying to translate mouse coords to precise isometric coords (I can already find the tile the mouse is over, but I want it to be more precise). I've tried several different methods but I seem to keep falling short. For drawing I use: batch.draw( texture, (y * tileWidth / 2) + (x * tileWidth / 2), (x * tileHeight / 2) - (y * tileHeight / 2)) This is what I currently use for figuring out a tile position: float xt = x + camPosition.x - (ScreenWidth/2) ; float yt = (ScreenHeight) - y + camPosition.y - (ScreenHeight/2); int tileY = Math.round((((xt) / tileWidth) - ((yt) / tileHeight))); int tileX = Math.round((((xt) / tileWidth) + ((yt) / tileHeight))- 1); I'm just wondering how I could update these to allow for more precise coordinates, instead of tile only. EDIT: Following what ccxvii said below, and removing the -1 from tileX, the object follows my mouse just like I had wanted. Just going to re-examine the math and figure out if that change will result in other messes =o

    Read the article

1