Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
通常,Axis-aligned (rotation = 0) tilemap 很容易遍历屏幕上的可见图块。
但是当整个瓦片地图旋转时,你如何“剔除”或过滤瓦片索引?
注意:这是为了改进 ActionScript 3.0(在Genome2D中)中的平铺渲染类,但其他计算机语言的答案也同样适用!:)
我不是 100% 清楚你要对每个图块做什么,所以我假设你想找到要渲染的块和不渲染的块。
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObject.html#hitTestObject()
您可以尝试在屏幕上设置一个虚拟对象并执行以下操作:
For each tile in tilemap if (dummyScreenObj.hitTestObject(tile)) tile.visible = true else tile.visible = false