Okay, I'm working on a game (different than my other one.) Here's the current build http://img151.imageshack.us/my.php?image=tank2ar.swfThe problem I have is that when the bullet you fire hits the enemy tank, it all disappears from the screen. I honestly haven't a clue on what causes this; totally stumped. The faintest inkling of a hint of a clue would be appreciated and is desperately needed! | CODE | onMouseDown = function () { if (turret._currentFrame == 1) { fireCannon(); } };
fireCannon = function () { this.turret.play(); var nm = "bullet"+sCount; bullets.attachMovie("CannonShot", nm, sCount); bullets[nm]._x = turret._x+Math.cos(turret.ang)*60; bullets[nm]._y = turret._y+Math.sin(turret.ang)*60; bullets[nm].dx = Math.cos(turret.ang)*72; bullets[nm].dy = Math.sin(turret.ang)*72; bullets[nm].onEnterFrame = function() { this._x += this.dx; this._y += this.dy; var enemy = "enemy"+eCount; if (this.hitTest(enemies[enemy])) { this.removeMovieClip(); enemies[enemy].play(); } }; sCount++; }; createEnemy = function (type, x, y) { var nm = "enemy"+eCount; enemies.attachMovie(type, nm, eCount); enemies[nm]._x = x; enemies[nm]._y = y; enemies[nm].dy = Math.random()*3+2; enemies[nm].dx = 0; enemies[nm].onEnterFrame = function() { this._x += this.dx; this._y += this.dy; var bullet = "bullet"+sCount; if (bullets[bullet].hitTest(this)) { this.play(); } }; };
|
--------------------
I may not talk much, but at least I are more smarter than you!
|