Skip to content

Instantly share code, notes, and snippets.

@KartikShrivastava
Created July 28, 2022 08:46
Show Gist options
  • Save KartikShrivastava/0738b115fd16673ab24e544a3c320491 to your computer and use it in GitHub Desktop.
Save KartikShrivastava/0738b115fd16673ab24e544a3c320491 to your computer and use it in GitHub Desktop.
if(hexMapUtil) {
if(hexMapUtil->staggerAxis == "x") {
tile->set_x(currX * (tileWidth - (hexMapUtil->hexSideLength/2)));
if((currX%2 == 0 && hexMapUtil->staggerIndex == "odd") || (currX%2 != 0 && hexMapUtil->staggerIndex == "even"))
tile->set_y(currY*tileHeight);
else
tile->set_y(currY*tileHeight + hexMapUtil->hexSideLength);
}
else {
tile->set_y(currY * (tileHeight - (hexMapUtil->hexSideLength/2)));
if((currX%2 == 0 && hexMapUtil->staggerIndex == "odd") || (currX%2 != 0 && hexMapUtil->staggerIndex == "even"))
tile->set_x(currX*tileWidth);
else
tile->set_x(currX*tileWidth + hexMapUtil->hexSideLength);
}
}
else {
tile->set_x(currX*tileWidth);
tile->set_y(currY*tileHeight);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment