I currently have a player mc, and a background mc. The player is surrounded by 4 rectangles that on hit move background mc (therefore creating a scrolling map).
background mc is a compilation of smaller mc’s. I want to individually set swapdepths for these smaller mc’s using the code below. However this doesn’t seem to work and my player just walks over the background.
onClipEvent (enterFrame) {
if (this.hitTest (_root.player)) {
this.swapDepths (this_x + this._y+64);
}
}
onClipEvent (load) {
this.swapDepths (this_x + this._y+64);
}
I’m assuming the swap depths isn’t working because these MC’s are contained in one MC Background. But I can’t scroll the map without them being in a container MC (unless I want to individually reference every smaller mc to move).
Any insight or suggestion would be fantastic.