Sign in to follow this  

Question about hex tiles

Recommended Posts

Both are just general: 1) I'm writing a tile based game with hex tiles as opposed to the normal squares (turn based strategy game). Things are going extremely well overall but I've gotten frustrated trying to write a function to accurately select tiles via the mouse (I can move around with arrow keys without a problem). I'm just having real trouble writing any kind of function that takes the mouse position in pixels and converting it to the correct tile if I click outside the "interior square" of the hex. Now if I click on the Rectangular portion in the middle, everything works fine. However if I click on the pointy bits at the top or bottom I get the tile to the upper left or upper right of the tile I want. any advice or links here would be much appreciated. This is all in C++ utlizing SDL if that matters at all.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this