Have you ever written code like this:
newBullet.x = hero.gun.x; newBullet.y = hero.gun.y; |
…and found that the bullet appears in a seemingly random place compared to the hero’s gun?
Or have you ever traced tank.turret.rotation
and found that it always returns zero, even when it’s clearly pointing diagonally?
Maybe you’ve compared the width
of two identical objects, one obviously double the size of the other, and found that Flash thinks they are the same.
Every Flash dev I know has run across one of these and sat scratching their head — myself included!
So what’s going on?
Well, it’s all to do with addChild()
…
(...)
Read the rest of Understanding Flash’s Coordinate Systems
© MichaelJW for Michael James Williams, 2009. |
Permalink |
30 comments |
Add to
del.icio.us
Post tags: addChild, coordinate systems, coordinates, globaltolocal, localtoglobal, rotation
Feed enhanced by Better Feed from Ozh