# Make multiple objects remain in motion

**URL:** <https://forum.kirupa.com/t/make-multiple-objects-remain-in-motion/322303>\
**Category:** Uncategorized\
**Created:** [May 17, 2011, 3:00pm UTC](https://forum.kirupa.com/t/make-multiple-objects-remain-in-motion/322303 "2011-05-17T15:00:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![12abhi12](https://avatars.discourse-cdn.com/v4/letter/1/9f8e36/32.png) [@12abhi12](https://forum.kirupa.com/u/12abhi12)\
**Post date:** [May 17, 2011, 3:00pm UTC](https://forum.kirupa.com/t/make-multiple-objects-remain-in-motion/322303/1 "2011-05-17T15:00:10Z")

</div>

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-

```auto

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.
