Please tell me if there is more information required to solve this problem
I have an array that lists objects followed by their locations and I'm iterating through it to find what frame the program is to go to.
So the loop that iterates through the list is bound the the character object so the character changes frames when it hits an object in the list.
I cut some stuff out so this isn't a code dump
function moveDude(e:Event){
var obj:Object = e.target;
for (i = 0; i<cols.length; i+=2)
{
if (cols[i] != null)
{
if (obj.hitTestObject(cols[i]))
{
gotoAndStop(cols[i+1]);
break;
}
}
}
Array of objects defined outside function
var cols = new Array(world.t1,6,world.lv1,"donkeyKong",background1.hit,3,world.door,1);
http://prntscr.com/5mqdpm the function in defined in the frame that extends over the other frames and then is added or removed from the character object if the character is using the listener or not.
example on first frame:
if (character!=null)
{ character.addEventListener(Event.ENTER_FRAME, moveDude);
}
this all works fine, however when the character travels from one frame to another, the hitTest with the object that returns it to frame 1 does not work? see the last object/frame in the array, it's not being detected in the for loop mentioned below
obj? Your cols array and iterating every other item is a strange way to set this up.Spritefor each scene or game state, and organize your code that way.