Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 09 May 2011 - 09:33 PM
Posted 10 May 2011 - 02:44 AM
Posted 10 May 2011 - 09:25 AM
You might want to take a look at this http://www.tonypa.pr.../tbw/tut16.html .
PS. Google is your friend. You can use it to find algorithms and formulas for practically every case you might think of.
PPS. It's not width of the program. It's the width of your tile. Read the tutorial and you will understand.
Posted 13 May 2011 - 07:06 AM
Posted 15 May 2011 - 07:58 AM
They are just two lines of equations that don't work magic. There's a bit more of preparations beforehand. Did you read the tutorial from the link I provided? The calculations needed to convert screen coordinates to isometric coordinates are provided in there.
Posted 15 May 2011 - 05:00 PM
They are just two lines of equations that don't work magic. There's a bit more of preparations beforehand. Did you read the tutorial from the link I provided? The calculations needed to convert screen coordinates to isometric coordinates are provided in there.
Yes, I have read the article.
No, I think I must've not given the right question. What I meant to say is, when you want to search a math formula and its theory behind it, without having any knowledge to what that math formula is all about prior to searching, what is the trick to searching for these information when using Google? How do come up with the search term that I could easily apply and get the results what I wanted if given a math formula yet there's not much information to be conveyed from?
Posted 10 June 2011 - 01:50 PM
// TileX and TileY are the array locations of the tiles. // TileWidth is set to 64 pixels wide. // TIleHeight is set to 32 pixels high. // The graphic tiles are 64x64 // ScreenX and ScreenY is the location to draw the tile. // OffsetX and OffsetY offset the drawn tiles to center the display. ScreenX = OffsetX + TileY*TileWidth/2 + TileX*TIleWidth/2; ScreenY = OffsetY - TileX*TIleHeight/2 + TileY*TileHeight/2;
// TileX and TileY are the array locations of the tiles. // TileWidth is set to 64 pixels wide. // TIleHeight is set to 32 pixels high. // The graphic tiles are 64x64 // In my game, i adjusted the mouse location so it will detect the correct tile that is under the mouse. MouseX = Mouse.getX()+16; MouseY = Mouse.getY()-40; // get the Offsets to calculate the correct tile. OffsetX = dungeonView.getViewDeltaX(); OffsetY = dungeonView.getViewDeltaY(); // use reverse math to get the grid of every other tile. MapX = (int) (MouseX/TileWidth - OffsetX/TileWidth - MouseY/TIleHeight + OffsetY/TIleHeight); MapY = (int) (MouseX/TileWidth - OffsetY/TileWidth - OffsetY/TIleHeight + MouseY/TIleHeight); // get screen locations of that tile. ScreenX2 = OffsetX + MapY*TileWidth/2 + MapX*TIleWidth/2; ScreenY2 = OffsetY - MapX*TIleHeight/2 + MapY*TileHeight/2; // This check here will give a quick and dirty check to see what part of the mouse is in the tile. // If it is in the first or last quarter of the x axis, it will check to see what the adjacent tiles are and change accordingly. if((MouseX-ScreenX2)<TileWidth/4+16){ if((MouseY-ScreenY2)<TileHeight/4*3-40){ MapY = MapY - 1; }else{ MapX = MapX - 1; } }else if((MouseX-ScreenX2)>TileWidth/4*3+16) { if((MouseY-ScreenY2)<TileHeight/4*3-40){ MapX = MapX + 1; }else{ MapY = MapY + 1; } }
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.