# Need help with this, c'mon help me out

**URL:** https://forum.kirupa.com/t/need-help-with-this-cmon-help-me-out/191674
**Category:** Uncategorized
**Created:** [June 22, 2006, 6:37am UTC](https://forum.kirupa.com/t/need-help-with-this-cmon-help-me-out/191674 "2006-06-22T06:37:36Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![woad](https://avatars.discourse-cdn.com/v4/letter/w/34f0e0/32.png) [@woad](https://forum.kirupa.com/u/woad)
#### Post date: [June 22, 2006, 6:37am UTC](https://forum.kirupa.com/t/need-help-with-this-cmon-help-me-out/191674/1 "2006-06-22T06:37:36Z")

</div>

I’m trying to get the bullet to go the angle of where the mouse click was. But it doesn’t work! I can’t figure out why, it thinks that the angle is -1 or something I have no idea and copied and pasted code I _know_ and yet it still doesn’t. I’ll post code for non flash 8 users and attach for flash 8 users.  
Why isn’t this working, also there’s a problem where it doesn’t delete the movieclips after they’ve left the stage area, dunno why either, doesn’t even show up that they left the bounds when they definately have.

[http://www.filefactory.com/?0ae506](http://www.filefactory.com/?0ae506)

Code:

onClipEvent(load)  
{  
bulletNum = 0;  
bullet = new Array();  
stageWidth = 500;  
stageHeight = 450;  
}  
onClipEvent(mouseDown)  
{  
// duplicate the bullet mc  
var mc = \_root.attachMovie(“bullet”,“bullet”+bulletNum,bulletNum);  
mc.\_x = \_root.start.\_x;  
mc.\_y = \_root.start.\_y;  
// set the coords to the mouse clik  
var theta:Number = Math.atan2(\_ymouse - mc.\_y, \_xmouse - mc.\_x);  
// increment the bullet number  
bullet.push({instance:mc, way:theta});  
++bulletNum;  
// if more than 5 bullets , start again at 0  
}  
onClipEvent(enterFrame)  
{  
//deal with existing bullets  
for(var i=bullet.length-1;i\>=0;i–)  
{  
//reduce alpha and scale  
bullet\*.instance.\_x += Math.cos(bullet\*.way) \* 10;  
bullet\*.instance.\_y += Math.sin(bullet\*.way) \* 10;

//if this is one off stage, remove it  
if(bullet\*.\_x \> stageWidth or bullet\*.\_x \< 0 or bullet\*.\_y \> stageHeight or bullet\*.\_y \< 0)  
{  
//remove array  
bullet.splice(0,1);

//remove movie clip  
bullet\*.instance.removeMovieClip();  
trace(‘removed?’);  
}  
}  
}
