# I know there's a quick answer to

**URL:** https://forum.kirupa.com/t/i-know-theres-a-quick-answer-to/155608
**Category:** Uncategorized
**Created:** [July 19, 2005, 4:36am UTC](https://forum.kirupa.com/t/i-know-theres-a-quick-answer-to/155608 "2005-07-19T04:36:04Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![smack\_boom](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@smack\_boom](https://forum.kirupa.com/u/smack_boom)
#### Post date: [July 19, 2005, 4:36am UTC](https://forum.kirupa.com/t/i-know-theres-a-quick-answer-to/155608/1 "2005-07-19T04:36:04Z")

</div>

my code. When you press space it’s suppose to attach the bullet MC and make it move in the direction its facing. I’ve beed playing with this code for a half hour now, so i think it’s tie to ask. Again I know there’s a quick solution.

Here it is:

```auto
onClipEvent (load) {
this.shooting = false;
}
onClipEvent (enterFrame) {
if (this.shooting == true) {
for (counter=0; counter<10; counter++) {
attachMovie("bullet", "bullet"+counter, 0);
_root["bullet"+counter]._x = _root.main._x;
_root["bullet"+counter]._y = _root.main._y;
_root["bullet"+counter]._rotation = _root.main._rotation;
var speed = 40;
if (_root["bullet"+counter]._rotation<0) {
_root["bullet"+counter].xmove = ((speed)*Math.sin(Math.PI/180*(360+_root["bullet"+counter]._rotation)));
_root["bullet"+counter].ymove = ((-speed)*Math.cos(Math.PI/180*(360+_root["bullet"+counter]._rotation)));
} else {
_root["bullet"+counter].xmove = ((speed)*Math.sin(Math.PI/180*(_root["bullet"+counter]._rotation)));
_root["bullet"+counter].ymove = ((-speed)*Math.cos(Math.PI/180*(_root["bullet"+counter]._rotation)));
}
_root["bullet"+counter].onEnterFrame = function() {
_root["bullet"+counter]._x -= _root["bullet"+counter].xmove;
_root["bullet"+counter]._y -= _root["bullet"+counter].ymove;
};
}
}
if (Key.isDown(Key.SPACE)) {
this.shooting = true;
}
}

```
