Skip to content

Instantly share code, notes, and snippets.

@KartikShrivastava
Created August 2, 2022 17:21
Show Gist options
  • Save KartikShrivastava/5c2b9893b1bd5777b28b60b2bf0073e9 to your computer and use it in GitHub Desktop.
Save KartikShrivastava/5c2b9893b1bd5777b28b60b2bf0073e9 to your computer and use it in GitHub Desktop.
else if(roomOrientation == RoomOrientation::isometric) {
int xStart = ((layerWidth * mapTileWidth) / 2) /*Mid x coordinate of the room in pixels*/
- (mapTileWidth / 2) /*Reposition by an offset of half of tileWidth*/
- (currY * (mapTileWidth / 2)); /*Reposition x coordinate depending on the row index or currY*/
int x = xStart + (currX * mapTileWidth / 2);
int y = (currY * mapTileHeight / 2) + (currX * mapTileHeight / 2);
tile->set_x(x);
tile->set_y(y);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment