Okay, so I have an object that gets attached to the stage everytime I click (like a side shooting game). What I want is the object to have a speed in a specific direction. I got it to work by the code-
if (total_bolt_no>0) {
var bolt_name="bolt"+total_bolt_no;
var bolt_n:Sprite=this.getChildByName(bolt_name) as heroweapon;
bolt_n.name="bolt"+total_bolt_no;
bolt_n.x+=Math.cos(angle3*(Math.PI/180))*boltspeed;
bolt_n.y+=Math.sin(angle3*(Math.PI/180))*boltspeed;
trace("Highlighting "+bolt_name,bolt_n.name);
}
The problem that arises is that when I spawn another object the previous one becomes still. I tried using the for loop but everytime I click the angle also changes, thus changing the speed of all attached objects.
Please help.