Hello,
I made a movie clip called mainMap and inside main map I have my main character which stays in place… a boundry area that moves… if the scale is 100, everything is fine.
but if I modify the xscale / yscale everything is thrown off… for example… the actual hittest is true several hundred pixels below where the boundry object is.
If I move all the components to the main timeline and modify the scale of root… everything is fine.
Is there any way to modify the scale without causing mis-alignment?
Code Below
//I load the position of the objects first
function initPos(obj, solid, action, actionType, actionCall, initX, initY, wayPoint){
//trace(“dasdasd”)
this.objArray[i2] = {obj:obj, objX:obj._x, objY:obj._y, solid:solid, action:action, actionType:actionType, actionCall:actionCall, initX:initX, initY:initY, wayPoint:wayPoint};
i2++;
}
onEnterFrame = function(){
//trace(boundry.hitTest(_xmouse, _ymouse, true) + “<<<<”)
trace(this._xscale)
mainDistance = checkDistance(nudgeXTemp, nudgeX, nudgeYTemp, nudgeY);
//char1._x = 0//((_parent._width/10));
//char1._y = 0//((_parent._height/10));
changeFace(nudgeX, nudgeXTemp, nudgeY, nudgeYTemp);
if(mainDistance>1 || moving == true){
nudgeX += (nudgeXTemp - nudgeX)*tweener;
nudgeY += (nudgeYTemp - nudgeY)*tweener;
ixx++;
collide=false;
for(i=0;i<objArray.length;i++){
collide = checkCollision(this.objArray*.obj, this.objArray*.solid, this.objArray*.action, this.objArray*.actionType, this.objArray*.actionCall);
//trace(collide+"-"+ixx)
if(!collide) {
this.objArray*.obj._x = this.objArray*.objX + nudgeX;
this.objArray*.obj._y = this.objArray*.objY + nudgeY;
//trace("processing" + ixx)
}else{
this.objArray*.obj._x = this.objArray*.objX + nudgeXTemp;
this.objArray*.obj._y = this.objArray*.objY + nudgeYTemp;
trace("COLLISION!!!")
}
this.objArray*.obj._x = this.objArray*.objX + nudgeX;
this.objArray*.obj._y = this.objArray*.objY + nudgeY;
}
}else{
moving=false;
nudgeX = nudgeXTemp;
nudgeY = nudgeYTemp;
this.objArray*.obj._x = nudgeX;
this.objArray*.obj._y = nudgeY;
//trace("colide")
}
boundryX= nudgeX - nudgeXTemp + xx + nudgeCharX;
boundryY= nudgeY - nudgeYTemp + yy + nudgeCharY + 0;
if(mainDistance<1) moving = false;
}
function checkDistance(x1, x2, y1, y2){
xdist = Math.round(x2 - x1);
ydist = Math.round(y2 - y1);
dist = Math.round(Math.sqrt((xdistxdist) +(ydistydist)));
return dist;
}
function checkCollision(obj, solid, action, actionTag, actionCall){
hit = “”;
if(actionTag==“XX”){
//trace(boundry._y + “xxxx” + obj._y + “—>” char1._y)
}
if(obj.hitTest(char1._x+nudgeCharX*1.5, char1._y+nudgeCharY*1.5, true)){
if(solid && action=="none"){
return true;
}else if(solid && action==""){
return false;
}else if (!solid && actionCall=="rollOver"){
node = actionTag;
trace(node)
if(action=="slides"){
playSlides(actionTag);
return false;
}
if(action=="movies"){
playMovie(actionTag);
return false;
}
}else{return false;}
}else{
return false;
}
}
please help. thanks!