[LEFT]Problem as follows…
I’m creating a flash game that throws rotten fruit at a band. When the game starts you select what type of fruit you want. There are 10 different fruits. I created a empty movie clip called —var ammoCon:MovieClip = new MovieClip(); to hold whichever fruit the use selects by the addChild(tomato_mc); method.
Right now the problem I have is that when I “fire” the fruit at the band I cannot fire another shot till the first shot has hit it’s target and been removed from the display list. If I do try to fire another shot the one currently in flight is removed instantly.
What I need is to fire the fruit as fast as I want. I know I need to use an array. The problem is I can’t figure out how to store the TweenMax Tweens into an array. And I’m not sure that’s my only problem, I think there are a few other code mistakes. I know how to add the fruit to the empty movieClip, but not sure how to add this object to a tween array.
ps TweenMax is the only Tween lib I can use because it contains the besier curve method
Please help. If you need further description of the problem I will give it.
here is the code that has had me stumped for a few days…
//-------buildAmmo-------//
function buildAmmo(ammo:MovieClip):void{
//trace(ammoCon.numChildren);
if(ammoCon.numChildren == 1){
ammoCon.removeChildAt(0);
}
//ammoCon.addChild(ammo);
currentAmmo = ammo;
trace(currentAmmo);
}
function fireFruit(e:MouseEvent):void{
randomX = Math.random() * 649;
//ammoCon.addChild(currentAmmo);
//ammoCon.x = randomX;
//ammoCon.y = stage.stageHeight;
splatAreaX = mouseX;
splatAreaY = mouseY;
swoosh1Fx.play();
ammoConArray[ammoConArrayCounter] = new AmmoConMC();
ammoConArray[ammoConArrayCounter].addChild(ammoCon);
ammoConArray[ammoConArrayCounter].x = randomX;
ammoConArray[ammoConArrayCounter].y = stage.stageHeight;
ammoConArray[ammoConArrayCounter].visible = true;
ammoCon.visible = true;
//-------the best tween Engine ever!!!!!!!!!!!!!!!!!
TweenMax.to(ammoConArray[ammoConArrayCounter], ammoSpeed, {x:splatAreaX, y:splatAreaY, onComplete:checkHitArea, bezier:[{x:randomX ,y:stage.stageHeight - 100}], orientToBezier:true});
//trace(ammoConArray.length);
//trace(ammoConArray[ammoConArrayCounter].getChildAt(0));
//trace(ammoConArray.length);
ammoConArrayCounter++;
if(ammoConArray.length >= 7){
ammoConArray.pop();
ammoConArrayCounter--;
}
}
[/LEFT]