Im trying to develop a way for my game to determin what difficulty settings were selected before making an action. So what I have tried to do is develop an IF/ELSE statment that says:
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#808080]//easy</p>[/COLOR]
<p>this.[COLOR=#0000ff]onEnterFrame[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]</p>
<p>if COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]</p>
<p> [COLOR=#000000]var[/COLOR] easy:[COLOR=#0000ff]Array[/COLOR] = [COLOR=#000000]new[/COLOR] [COLOR=#0000ff]Array[/COLOR]COLOR=#000000[/COLOR];</p>
<p> [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]gotoAndStop[/COLOR][COLOR=#000000]([/COLOR]easy[COLOR=#000000][[/COLOR][COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]floor[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]random[/COLOR]COLOR=#000000[/COLOR] * easy.[COLOR=#0000ff]length[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]][/COLOR][COLOR=#000000])[/COLOR];</p>
<p>[COLOR=#808080]//normal</p>[/COLOR]
<p>[COLOR=#000000]}[/COLOR] [COLOR=#0000ff]else[/COLOR] [COLOR=#0000ff]if[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]</p>
<p> [COLOR=#000000]var[/COLOR] normal:[COLOR=#0000ff]Array[/COLOR] = [COLOR=#000000]new[/COLOR] [COLOR=#0000ff]Array[/COLOR]COLOR=#000000[/COLOR];</p>
<p> [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]gotoAndStop[/COLOR][COLOR=#000000]([/COLOR]normal[COLOR=#000000][[/COLOR][COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]floor[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]random[/COLOR]COLOR=#000000[/COLOR] * normal.[COLOR=#0000ff]length[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]][/COLOR][COLOR=#000000])[/COLOR];</p>
<p>[COLOR=#808080]//hard</p>[/COLOR]
<p>[COLOR=#000000]}[/COLOR] [COLOR=#0000ff]else[/COLOR] [COLOR=#0000ff]if[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]</p>
<p> [COLOR=#000000]var[/COLOR] hard:[COLOR=#0000ff]Array[/COLOR] = [COLOR=#000000]new[/COLOR] [COLOR=#0000ff]Array[/COLOR]COLOR=#000000[/COLOR];</p>
<p> [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]gotoAndStop[/COLOR][COLOR=#000000]([/COLOR]hard[COLOR=#000000][[/COLOR][COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]floor[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]random[/COLOR]COLOR=#000000[/COLOR] * hard.[COLOR=#0000ff]length[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]][/COLOR][COLOR=#000000])[/COLOR]; </p>
<p> [COLOR=#000000]}[/COLOR]</p>
<p>[COLOR=#000000]}[/COLOR]; </p>
<p>
[/LEFT]
[/FONT]
Using various arrays to try and make it randomly select a certain frame just seems to be causeing issues. Its not actually selecting a frame and stoping… its just going nuts and I have no idea how to stop it.
Any ideas? Please take a look at the example I made.
Mark