I would like to make a shooter which fires out of a canon at various points based on mouse click. So for now what i have done is I have a start point which is the mouth of the canon and the end point which is the place where the person clicks. And upon click, the cannon fires.
Simply put the canon waits for a mouse click. on click, it fires but the movement ends at point where the user clicked. This doesnt look cool if the target has moved or the user has not even clicked on the appropriate target. I would prefer if the cannonball could continue to move along that line until it goes off the stage when it is deleted.
Currently, I am using tweener class, so my code looks something like this.
private function moveIt(e:Event):void{
Tweener.addTween(e.target,{x:mouseX,y:mouseY,time: 1,onComplete:disappearMe(e.target)});
}
private function disappearMe(e:Object):void {
Tweener.addTween(e,{delay:1,alpha:0});
}
Any assistance would be greatly appreciated.
Thanks