Wednesday, May 23, 2012

[Action Script] Removing arrays when character walks over switch. HELP. May,2012

Hi guys, I'm quite new to Arrays so I don't know if I'm doing this right
Basically when the character walks over a detonator, the detonators array is removed ,and the dynamites array should be removed also.
The issue I find is that, the array for the detonator is removed when it is walked over, but the image is not removed, and also when the detonator is walked upon, the dynamite array and image are not removed either
Here is the code so far:

for (var d =0; d<detonators.length;d++){
if (koala[k].hitTestObject(detonators[d])){
removeChild(detonators[d]);
removeChild(dynamites[j]);
detonators.splice(d,1);
dynamites.splice(j,1)
dynamites[j].removeEventListener(Event.ENTER_FRAME, moveDynamite);
detonators[d].removeEventListener(Event.ENTER_FRAME, moveDetonator);
trace('detonators' +detonators.array)
Removing arrays when character walks over switch. HELP.

Related Post



0 comments: