[font="]Hi
I’m making my first flash game so forgive me if there is anything with my actionscript or my explaining that is messed up.
This game is a 4 player (<–will be) tank game that fires bullets and stuff. so far its working just how i want it to apart from one thing… the duplication for the bullet. This snippet of the script is the bit that should make the bullet firing. if you look at these to bits of script “_root.depth += 1;”, “duplicateMovieClip(_root.bullet, “bullet”+depth, depth);” to my understanding the “depth” should increase BUT it doesn’t? does anyone know what is going on? please help
[/font]
Cut out from script:
[color=Blue] onClipEvent (load) {
bulspeed = 30;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.DOWN)) {
//depth var should increace but doesn’t for some strange reason
//proved by traced message
_root.depth += 1;
trace(this.depth);
angle = this._rotation+180+90;
duplicateMovieClip(_root.bullet, “bullet”+depth, depth);
_root.bullet._x = this._x;
_root.bullet._y = this._y;
_root.bullet.xbulspeed = Math.cos(angle*Math.PI/180)bulspeed;
_root.bullet.ybulspeed = Math.sin(angleMath.PI/180)bulspeed;
_root.bullet.onEnterFrame = function() {
this._x += this.xbulspeed;
this._y += this.ybulspeed;
if (this._x<0 || this._x>750 || this._y<0 || this._y>550) {
delete this.onEnterFrame;
this.removeMovieClip();
}
};
}
}[/color]*
Anyway if that sounded very confusing then the .fla file is attached so you can have a look at it for your self and see whats up if you want.
thanks