hi kirupa-folk,
a friend of mine and me are together working on a kinda “star fighter” game in flash. you know, you’ve your space-ship and you’re flying through a level and trying to destroy as much enemy-ships as your fingers let you
i got to a point, where i may not be able to get further without some help of you experts
my problem:
in the level you are flying through with your space-ship is a number of **n **enemy-space-ships. you’re able to fire bullets from your own space-ship, which should hit the other enemy-space-ships to destroy them.
so far, so good, but how can i discover, which bullet hits which enemy-space-ship? here is my code-snippet:
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#0000ff]if[/COLOR][COLOR=#000000]([/COLOR] [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]hitTest[/COLOR][COLOR=#000000]([/COLOR]level1_MC[COLOR=#000000][[/COLOR][COLOR=#ff0000]"enemy_MC"[/COLOR] + i[COLOR=#000000]][/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR][INDENT] removeMovieClip[COLOR=#000000]([/COLOR][COLOR=#0000ff]this[/COLOR][COLOR=#000000])[/COLOR];
[/INDENT][INDENT] level1_MC[COLOR=#000000][[/COLOR][COLOR=#ff0000]“enemy_MC”[/COLOR] + i[COLOR=#000000]][/COLOR].[COLOR=#0000ff]_visible[/COLOR] = [COLOR=#000000]false[/COLOR]; [COLOR=#808080]// replace with removeMovieClip();[/COLOR]
[/INDENT][INDENT] delete [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]onEnterFrame[/COLOR];
[/INDENT][COLOR=#000000]}[/COLOR]
[/LEFT]
[/FONT]
ok, this code-snippet is nested in an onEnterFrame-statement…the variable i is incremented every time, a new bullet is fired off. understandably, with this code i’m just able to discover whether a bullet hits one specific enemy-ship, but i’ve to check, if a single bullet hits all enemy-space-ships in the entire level, and if this happened, then the enemy-space-ship, which was hitted should be destroyed…
i hope, you know what i mean, sry for my terrible english! :ne:
maybe some of you, can help me out in a theoretical approach, would be very very cool…!!!