Flash lineStyle 圆的厚度?

发布于 2024-08-22 23:58:43 字数 314 浏览 3 评论 0原文

包含我的游戏世界中所有元素的精灵使用现实世界的米作为距离单位,它不知道像素是什么。然后,我对该精灵应用比例,使其在屏幕上显示正确。目前我使用 1 米 = 100 像素,因此比例 = 100。

如果我尝试在该精灵内绘制一条线,则会出现 lineStyle(thinkness) 对厚度参数进行四舍五入。如果我指定 0.5(50 厘米),它总是以 1 像素(1 厘米)绘制。如果我指定 0.6,线条将变为 100 像素或 1 米粗。所以基本上我只能画 1、100、200 等像素的线条。

对此我能做些什么吗?否则我将不得不在我的世界中使用更小的单位,例如毫米。

The sprite which contains all element in my game world uses the real-world meter as distance unit, it doesn't know what pixels are. I then apply a scale to this sprite to make it appear correct on screen. Currently I use 1 meter = 100 pixels, so scale = 100.

If I try to draw a line inside this sprite it appears lineStyle(thinkness) rounds the thickness parameter. If I specify 0.5 (50 cm) it always gets drawn with 1 pixel (1 cm). If I specify 0.6, the line becomes 100 pixels, or 1 meter, thick. So basically I can only draw lines of 1, 100, 200 etc pixels thinkness.

Anything I can do about this? Otherwise I'll have to use a smaller unit like millimeters for my world.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

做个少女永远怀春 2024-08-29 23:58:43

lineStyle 的粗细参数应为 0 到 255 范围内的整数。该整数是线条的粗细(以磅为单位)。因此发送真实值只会让 Flash 感到困惑。您必须自己进行数学计算,然后向 lineStyle 传递适当的整数值。如果 1 米 = 100 像素,并且一个点合理地近似于一个像素,您需要将厚度值(以米为单位)乘以 100,然后转换为整数。

The thickness parameter for lineStyle should be an integer in the range 0 to 255. This integer is the thickness of the line in points. So sending a real value just confuses Flash. You'll have to do the math yourself, then pass lineStyle the appropriate integer value. With your 1 meter = 100 pixels, and a point reasonably approximated by a pixel, you'd want to multiply your thickness values in meters by 100, then convert to an integer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文