hi.
i have a couple of problems:
- before the spawning of the enemies start i can already see there bullets firing… how do i fix it so i see them only when the enemys are visible.
- how do i get the bullets to come out of all the enemys, they are doplicated to enemyq0,enemyq1…
this is my code so far
general
[LEFT]
bulletCounter = 0;
_root.enemy_bullet._visible = false;
_root.enemyq._visible = false;
_global.enemy2Count = 0;
enemies2 = new Array(0);
explode2=new Array(0);
shoot2 = function ()
{
bulletCounter++;
_root.enemy_bullet.duplicateMovieClip("enemy_bullet" +
bulletCounter,_root.getNextHighestDepth());
_root["enemy_bullet" + bulletCounter]._visible = true;
};
enemy2 = function ()
{
_root.enemyq.duplicateMovieClip("enemyq" + _global.enemy2Count, _root.getNextHighestDepth());
_root["enemyq" + _global.enemy2Count]._visible = true;
posX = random(500)+1
posy= random(500)+1
_root["enemyq" + _global.enemy2Count]._x = posX ;
_root["enemyq" + _global.enemy2Count]._y = posy;
enemies2[enemy2Count]="enemyq" + _global.enemy2Count
explode2[enemy2Count]="false"
_global.enemy2Count++;
};
setInterval(enemy2,4000);
setInterval(shoot2, 1000);
[/LEFT]
this is on my “enemy_bullet”:
onClipEvent (load)
{
reset=function(){
this._x = _root.enemyq0._x;
this._y = _root.enemyq0._y;
bulletSpeed = 5;
this._rotation = Math.atan2(_root.hero._y-this._y, _root.hero._x-
this._x);
}
reset();
}
onClipEvent (enterFrame)
{
this._x = this._x + Math.cos(this._rotation) * this.bulletSpeed;
this._y = this._y + Math.sin(this._rotation) * this.bulletSpeed;
}
any help would be grately appreciated…