Firstly, I know, Theres already a topic for this on AS:Main, but its dead and has been for a long time. So im trying to get an answer to something, but I guess this is the only way.
Alright, so ive got a game set up where Ive got my shooter (player), Background, and Bullets.
Although, I cant get the AS for the shooting to work. Its supposed to shoot when you click, no?
Heres the code on my Bullets MC - With the Instance name bullet
onClipEvent(load){
spd=20;
_x=_root.gun._x;
_y=_root.gun._y;
_rotation= _root.gun._rotation;
}
onClipEvent(enterFrame){
if(_name == "bullet"){
_x = -1000;
}else{
if (_rotation>180) {
_y += (spd*Math.cos( Math.PI/180*_rotation));
_x -= (spd*Math.sin( Math.PI/180*_rotation));
} else {
_y -= (spd*Math.cos (Math.PI/180*_rotation));
_x += (spd*Math.sin( Math.PI/180*_rotation));
}
}
if(_x>Stage.width || _x<0 || _y<0 || _y>Stage.height){
this.removeMovieClip();
}
}
Now, I get no syntax errors from that. So far, So good.
Next : The code on my first frame of my main timeline :
var bc=1000;
_root.onMouseDown=function(){
bc++;
if(bc>1100){ bc=1000; }
duplicateMovieClip("bullet", "b"+bc, bc);
}
And yet - When I click, nothing happens.
What Am i doing wrong? Thanks for any help that you can give me!
P.S, dont link me to the following/shooting at mouse Tut, I already read it.