-
AS3 Whack a mole game, Random MC generator help!!!
I am very new at Flash and I am creating a whack a mole game in Flash CS5 AS 3. I have nine instances of the same movie clip that I am trying to make appear randomly as the "mole". So far I have the following script:
var girlarray:Array = new Array();
girlarray[0] = instanceofhole1;
girlarray[1] = instanceofhole2;
girlarray[2] = instanceofhole3;
girlarray[3] = instanceofhole4;
girlarray[4] = instanceofhole5;
girlarray[5] = instanceofhole6;
girlarray[6] = instanceofhole7;
girlarray[7] = instanceofhole8;
girlarray[8] = instanceofhole9;
var i:Number = 0;for(i=0; i<girlarray[i].length; i++){
showThem();
function showThem():void {
var array:Array = girlarray;
var numShow:int = 9;
var rand:int = 0;
for (var i:int = 0; i < numShow; i++) {
rand = Math.random() * array.length;
MovieClip(array[rand]).play();
array.splice(rand, 1);
}
}
}
It isn't working HELP!!!!!
-
One thing I realized....
I have a MC called "thehole" and it holds an MC called "thegirl", "the girl" MC has an invisible button, that when clicked shows it has been clicked.
I am going to copy and paste "thehole" nine times on my main stage.
I was trying to randomize the playing of "thegirl" MC from the mainstage, but have realized that all the randomizing coding has to go into "the hole" mc and then be copied and pasted 9 times on the stage after I figure out how to randomize "the girl" inside "the hole". I need script to randomize "thegirl" first and foremost. Help a frustrated grad student out?
-
or maybe I should go back to plan A?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|