actionscript-3 - 如何在旋转的 tilemap 中查找屏幕边界的 tile 索引?

标签 actionscript-3 rotation tile bounds culling

通常,轴对齐(旋转 = 0)图 block map 很容易遍历屏幕上的可见图 block 。

但是当整个 tilemap 旋转时,你如何“剔除”或过滤 tile 索引?

enter image description here

注意:这是为了改进 ActionScript 3.0 中的平铺渲染类(在 Genome2D 中),但其他计算机语言的答案也同样适用! :)

最佳答案

我不是 100% 清楚你想用每个图 block 做什么,所以我假设你想找出哪些要渲染,哪些不渲染。

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

关于actionscript-3 - 如何在旋转的 tilemap 中查找屏幕边界的 tile 索引?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16150210/

相关文章:

actionscript-3 - 弹性/AS3 : how to manage re-draw of chart when changing multiple chart properties?

actionscript-3 - 1119 : Access of possibly undefined property alpha through a reference with static type flash. 实用程序 :Timer.

c# - 高架赛车游戏中的汽车/车辆在拐角处漂移

c# - 如何在C#中平铺两个程序窗口?

actionscript-3 - 无法扩展 Sound 对象原型(prototype)

actionscript-3 - photoshop 事件文档

android - 为什么支持FragmentManager.saveFragmentInstanceState(selectedFragment)!! = 空

iphone - 在设备旋转时自动调整 subview 的大小

JavaFX - 有没有一种方法可以使用 imageview 多次打印一张图像?

html - flexbox 四 block 布局