ok I need serious help.
the bullet is actually named “gascloud” and duplicated with the name “gas+i”
everything works fine with the duplicate movieclip.
The calculations on the bullets direction come out with solid numbers. the the variables work good with any instance on the stage, but with the duplicated clips it doesn’t work…
Does anyone know what i’m doing wrong here? perhaps something with naming the duplicates?
First frame code:
i = 0;
xspeed=0;
yspeed=0;
onEnterFrame = function(){
trace(xspeed);
XG = Math.atan2(p._x , _xmouse);
YG = Math.atan2(p._y , _xmouse);
xspeed = (XG/Math.PI*180);
yspeed = (YG/Math.PI*180);
_root.["gas+i"]._x += xspeed;
y = p._y - _ymouse;
x = p._x - _xmouse;
angle = Math.atan2(y ,x);
angle = (angle/Math.PI*180);
p._rotation= 270 + angle ;
}
Players code:
onClipEvent(load){
i = 0;
}
onClipEvent(enterFrame){
if(Key.isDown(87)){
this._y-=5;
}
if(Key.isDown(83)){
this._y+=5;
}
if(Key.isDown(65)){
this._x-=5;
}
if(Key.isDown(68)){
this._x+=5;
}
}
onClipEvent(mouseDown){
i ++;
_root.gascloud.duplicateMovieClip("gas"+i,i);
_root["gas"+i]._x = this._x;
_root["gas"+i]._y = this._y;
}
the player is instanced “p” and the bullet is instanced “gascloud”.