Be a Supporter!

Quick Q: inaccurate pixels...

  • 147 Views
  • 4 Replies
New Topic Respond to this Topic
Hero101
Hero101
  • Member since: Dec. 13, 2005
  • Offline.
Forum Stats
Supporter
Level 22
Game Developer
Quick Q: inaccurate pixels... 2013-12-08 17:15:40 Reply

Quick question: When I am creating MC to specific dimensions, for example 50x50 pixels, sometimes it will change it to
50.5x50. Even if I try to correct the 50.5 to 50 it will just snap back to 50.5. Why does it do this?

Is there a way to make it snap to the precise pixels I want. I know that with this small amount it isn't noticeable on screen but I'm not sure if it could make hit detection less accurate. Or maybe I'm just OCD about it haha


BBS Signature
kkots
kkots
  • Member since: Apr. 16, 2013
  • Offline.
Forum Stats
Supporter
Level 10
Blank Slate
Response to Quick Q: inaccurate pixels... 2013-12-08 17:29:05 Reply

At 12/8/13 05:15 PM, Hero101 wrote: Quick question: When I am creating MC to specific dimensions, for example 50x50 pixels, sometimes it will change it to
50.5x50. Even if I try to correct the 50.5 to 50 it will just snap back to 50.5. Why does it do this?

Happens often. Has something to do with floating point and imprecise computations.
Ain't nothing you can do other than make some slight changes to the shape and try again.
If you're referencing width or height, expecting them to be round values, you're better off manually typing those values out in your code.


BBS Signature
Hero101
Hero101
  • Member since: Dec. 13, 2005
  • Offline.
Forum Stats
Supporter
Level 22
Game Developer
Response to Quick Q: inaccurate pixels... 2013-12-08 17:31:25 Reply

Ah ok. Thanks for the reply dude.


BBS Signature
MintPaw
MintPaw
  • Member since: Jun. 11, 2006
  • Offline.
Forum Stats
Member
Level 10
Programmer
Response to Quick Q: inaccurate pixels... 2013-12-08 17:49:30 Reply

If you're worried about extremely accurate hit detection then you shouldn't be using the Flash IDE, you should be generating your objects in code, or using pngs. Realize that when you're working in the Flash IDE a lot of your values are going to be rounded wishy-washy decimals.


If ya have something to say, PM me. I have a lot of time to spare.
Also never PM egg82.

BBS Signature
Hero101
Hero101
  • Member since: Dec. 13, 2005
  • Offline.
Forum Stats
Supporter
Level 22
Game Developer
Response to Quick Q: inaccurate pixels... 2013-12-08 19:07:48 Reply

At 12/8/13 05:49 PM, MintPaw wrote: If you're worried about extremely accurate hit detection then you shouldn't be using the Flash IDE, you should be generating your objects in code, or using pngs. Realize that when you're working in the Flash IDE a lot of your values are going to be rounded wishy-washy decimals.

Thanks for the advice. I will eventually get to that point but right now I'm just making a demo game to practice grasping something else coding-wise. I'll definitely look into what you suggested for future work. Thanks again.


BBS Signature