KaTsuO_O Wrote:What I did was that I created a symbol that is 400 pixels wide, and placed the registration point between the left side and the middle of it. Then I added this code to flip it.
KaTsuO_O Wrote:I haven't tried this before, so thank you as well for making me learn another thing.
KaTSuO_O Wrote:Which works, but it is not a very good setup. So I would give the symbol inside, the instance name symbol, or any other simple name.
IrrelevantComment Wrote:object.transform.pixelBounds gives the rectangle of an mc on the stage.
object.globalToLocal(pt) converts a point from stage co-ords to local co-ords...flips the object and moves it to the correct place. maybe. or some shit like that, working this out in my head without checking. the point is, use transform
Gorepete Wrote:This might be over simplifying, but why don't you just wrap the object in another container that revolves around the center? That way you can flip and rotate around the new "center" but still place or locate around the original _x/_y values of the object? Unless I am misunderstanding your goal.
function checkDistance(obj)
{
if (!obj.once)
{
obj.once=true; //it just initializes it
//set center
obj.rect = obj.getRect(_root.Level); //'_root.Level' parameter already acts like localToGlobal.
obj.center= new flash.geom.Point(obj.rect.xMin+(obj.rect.xMax-obj.rect.xMin)/2,obj.rect.yMin+(obj.rect.yMax-obj.rect.yMin)/2);
}
//loop to check distance
obj.dist_x = _root.Level.PLAYER._x-obj.center.x;
obj.dist_y= _root.Level.PLAYER._y-obj.center.y;
if (obj.dist_x>-550 and obj.dist_x<550)
//do something
}
Users browsing this forum: No registered users