is there any easy way to make boundaries for the eadg of the stage? instead of making 4 separate MC’s. I can use the width and hieght variables of the stage to do it but it would still require 4 bits of code. So just wondering if anyone knows a way?
this is the only way i know
onClipEvent(enterFrame){
if (this._x<0){
this._x=0;
}
if (this._y<0){
this._y=0;
}
if (this._y>300){
this._y=300;
}
if (this._x>300){
this._x=300;
}
}
i don’t think there’s any other way but is this not efficient enough?
ya that looks right
yeh thats wot i would usualy use. I wos thinking sumthing like have _x positions on both sides in one statment.
hmm i don’t think that’s possible…
god moopers ur a flash genuis help me out man! check my many threads
i did it ^.^. i just used
if (_x+Speed>Stage.width || _x+Speed<0)
and same with the height. Just thought i would let u know it is possible.
Or do this so if the area changes, the bounding area changes. This is recommended if you like to initialize your values elsewhere (like at the start
onClipEvent(enterFrame){
if (this._x<CurrentxLeft){
this._x=minBoundx;
}
if (this._y<CurrentyTop){
this._y=minBoundy;
}
if (this._y>CurrentyBottom){
this._y=maxBoundy;
}
if (this._x>CurrentxRight){
this._x=maxBoundx;
}
}