我是新的,并希望创建一个瓷砖地图作为自我tuer。我想创造一个小(可能是7个海角宽/高)的六角地图。我的第一个想法是为了创建一个绘制一个十六进制的方法,然后只能翻译适当的偏移并放置新的十六进制。但这似乎并不效果。有任何想法吗?Alos作为一个侧面问题,如何确定MotionEvent是否在给定的十六进制中是一个给定的十六进制?

有帮助吗?

其他提示

To determine if a MotionEvent is within a certain hex you have to convert the coords passed in via the motion event to your OpenGL World coords. Its just like a unit conversion, you know the screen goes from 0 - WIDTH and your GL world lets say goes from -1 to 1.

(xCoord / (Width - 0)) * (1 - (-1)) = xCoordWorld

will give you the xCoord from 0 to 2, then subtract 1 to get it in -1 to 1.

As far as the hexes go I've always used 'art' hexes. Draw the hex out in paint then render a bunch of squares with that piece of art on them, fast and easy to swap a hex out for another hex.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top