Hey Everyone,
**EDITED TO AVOID CONFUSION
**
I’m sure this is a really basic problem and hope someone can steer me in the right direction.
I have moving objects on stage all with a width of exactly 100 pixels. They’re part of a collision array. I need to know their radii so I created a variable that looks like this:
radius = objectName.width/2;
You would think that this would result in 50. However, when I do a trace of their values in an enterFrame loop, I get a range of numbers that looks like this when the objects are standing still:
51.325
52.075
50
50
50
50
52.075
50
50
50
50
50
50
50
50
50
50
50
50
50
50
51.325
52.075
50
50
50
50
52.075
50
50
… and so on!
As you can see, some of the fluctuations are quite big. When the objects start moving, I see numbers that look like this:
50.725
52.15
51.975
50
50.725
52.15
51.975
50.725
52.15
51.975
52.15
51.975
51.975
I’m sure this is something very basic.
Does anyone have any idea what the problem could be?
**EDITED: Update **
I did some more checking. If I use trace(width/2) inside the enterFame loop of the object’s class itself, I see the same fluctuations.
However, when I declare a _radius property in the constructor and initialise it as:
_radius = width/2;
the number remains stable.
Any ideas?
Thanks!! 