Flash lineStyle rounds thickness?
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.
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.
精彩评论