So I want call a function from _root to movieclip:
Here’s the code on main _root:
[COLOR=#993300]
[COLOR=#993300]for[/COLOR][COLOR=#000000]([/COLOR][COLOR=#993300]var[/COLOR] i = [COLOR=#000000]0[/COLOR]; i < bulletArray.[COLOR=#993300]length[/COLOR]; i++[COLOR=#000000])[/COLOR]
[COLOR=#000000]{[/COLOR]
[COLOR=#f000f0]*//set a temporary variable that will store the current bullet from the array*[/COLOR]
[COLOR=#993300]var[/COLOR] temporaryBullet:[COLOR=#993300]MovieClip[/COLOR] = bulletArray[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR];
[COLOR=#f000f0]*//update temp bullet x & y based on its speed which we calculated during bullet creation*[/COLOR]
temporaryBullet.[COLOR=#993300]_x[/COLOR] += temporaryBullet.[COLOR=#000000]xSpeed[/COLOR];
temporaryBullet.[COLOR=#993300]_y[/COLOR] += temporaryBullet.[COLOR=#000000]ySpeed[/COLOR];
[COLOR=#f000f0]*//check for collision*[/COLOR]
checkEnemyHit[COLOR=#000000]([/COLOR]temporaryBullet[COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=black]Here’s the movieclip’s code:[/COLOR]
[COLOR=#000000][/COLOR]
[COLOR=#993300]
[COLOR=#993300]function[/COLOR] checkEnemyHit[COLOR=#000000]([/COLOR]_bullet:[COLOR=#993300]MovieClip[/COLOR][COLOR=#000000])[/COLOR]:[COLOR=#993300]Void[/COLOR]
[COLOR=#000000]{[/COLOR]
[COLOR=#993300]if[/COLOR][COLOR=#000000]([/COLOR][COLOR=#993300]this[/COLOR].[COLOR=#993300]hitTest[/COLOR][COLOR=#000000]([/COLOR]_bullet[COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR]
[COLOR=#000000]{[/COLOR]
[COLOR=#f000f0]*//this was hit*[/COLOR]
[COLOR=#993300]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]"it hits"[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]
[COLOR=black]So how to get this working propely? I have spent 3 days to find solution… nothing seems to work…
I have been trying to find any _global functions and similar but still no work.
Please help, this is very very important for my game! :diss:[/COLOR][/COLOR]
[/COLOR]