0

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.

Bart van Heukelom
  • 43,244
  • 59
  • 186
  • 301
  • I'm not sure what you would like the Flash player to do, split your pixels up into sub-pixels, and render the line at 0.6pixels thickness? – alecmce Feb 25 '10 at 05:06
  • It should round at the very end. After all a line of 0.06 is perfectly possible if you scale the whole image by 100, because it should result in a line of 6 pixels – Bart van Heukelom Feb 25 '10 at 09:10

1 Answers1

0

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.

Mr. Berna
  • 10,525
  • 1
  • 39
  • 42
  • I guess there's nothing else to do but that or something like it. Odd decision by Adobe though, they have no problem specifying boxes or bitmaps smaller than 1. – Bart van Heukelom Feb 28 '10 at 12:39