Hey, this is my first time working with swap depths so bare with me.
I’m trying to find a way to integrate swap depths with map scrolling. Here is my current code:
SWF:
www.swfcabin.com/open/127746933
var mapItem:Array = new Array(_root.tree1, _root.building1, _root.keith,_root.shinru);
mapControl = function () {
_root.player.swapDepths(_root.player._y);
for (var i:Number = 0; i<mapItem.length; i++) {
if (mapItem*.hitTest(_root.player)) {
_root.mapItem*.swapDepths(_root.mapItem*._y);
}
if (_root.player.hitTest(_root.boundLeft)) {
mapItem*._x += _root.moveSpeed;
_root.player._x += moveSpeed
}
if (_root.player.hitTest(_root.boundRight)) {
mapItem*._x -= _root.moveSpeed;
_root.player._x -= moveSpeed
}
}
};
The problem lies within the fact that the bounds are pushing away the player too fast for Flash to finish cycling through the array of items.
Please, any help is appreciated as I have thought of everything I could.
PS: I’m a novice when it comes to working with depth control, so feel free to post constructive criticism.
-Jephz