Another question about my whack-a-turkey game

For those of you that helped me earlier, I say thank you! However, I would like to add something to this game. Rather than just whacking turkeys the whole time, I’ve created an Indian that I’d like to appear randomly, but not as often as the turkeys and of course when the Indian comes out of the whole, the turkey in that whole cannot come out. If you whack the Indian, you lose 10 points as opposed to gaining 10 points when hitting a turkey.

I’ve created my Indian graphic and animation. I’ve placed 16 instances of it on the stage just like I did with my turkeys. So how can I make one Indian appear out of a single whole every once in a while, not as often as the turkeys and when the Indian comes out of the whole, the turkey in that whole cannot come out.

Below is the code I currently have, but I don’t have any code for the Indians. The Indians have similar instance names as the turkeys (indian1_mc, indian2_mc, etc.). You can view the game in it’s present state here. Thanks!


import flash.display.MovieClip;

/////////// CODE FOR ANIMATING THE TURKEYS ///////////
var turkeyArray:Array = new Array();

turkeyArray[0] = turkey1_mc;
turkeyArray[1] = turkey2_mc;
turkeyArray[2] = turkey3_mc;
turkeyArray[3] = turkey4_mc;
turkeyArray[4] = turkey5_mc;
turkeyArray[5] = turkey6_mc;
turkeyArray[6] = turkey7_mc;
turkeyArray[7] = turkey8_mc;
turkeyArray[8] = turkey9_mc;
turkeyArray[9] = turkey10_mc;
turkeyArray[10] = turkey11_mc;
turkeyArray[11] = turkey12_mc;
turkeyArray[12] = turkey13_mc;
turkeyArray[13] = turkey14_mc;
turkeyArray[14] = turkey15_mc;
turkeyArray[15] = turkey16_mc;

var turkeyTimer:Timer = new Timer(400);
turkeyTimer.addEventListener(TimerEvent.TIMER, playTurkeys);

function playTurkeys(event:TimerEvent):void
{
    var randomTurkey:int = Math.random() * turkeyArray.length;
    turkeyArray[randomTurkey].play();
}

turkeyTimer.start();

/////////// CODE FOR KEEPING SCORE ///////////

var score = 0;
updateScore();

function updateScore():void
{    
    this.score_txt.text = score + " PTS.";
}

/////////// CODE FOR SWAPPING THE MOUSE CURSOR ///////////

var cursor:MovieClip;

function initializeGame():void
{
    cursor = new Cursor();
    addChild(cursor);
    cursor.x = this.mouseX;
    cursor.y = this.mouseY;
    cursor.enabled = false;
    cursor.mouseEnabled = false;
    Mouse.hide();
    stage.addEventListener(MouseEvent.MOUSE_MOVE, dragCursor);    
    stage.addEventListener(MouseEvent.CLICK, playCursor);
}

function dragCursor(event:MouseEvent):void
{
    cursor.x = this.mouseX;
    cursor.y = this.mouseY;
}

function playCursor(event:MouseEvent):void
{
    cursor.play();
}

initializeGame();

/////////// CODE FOR THE COUNTDOWN TIMER ///////////

var timer:Timer = new Timer(1000, 60); 
timer.addEventListener(TimerEvent.TIMER, countdown); 
timer.start();
timer_txt.text = "01:00";

function countdown(event:TimerEvent):void
{
    var totalSecondsLeft:Number = 60 - timer.currentCount;
    var formatted:String = timeFormat(totalSecondsLeft);
    timer_txt.text = formatted;
    
    if(formatted == "00:00")
    {
        turkeyTimer.removeEventListener(TimerEvent.TIMER, playTurkeys);
        turkeyTimer.stop();        
        timer.removeEventListener(TimerEvent.TIMER, countdown); 
        timer.stop();
        nextFrame();
    }
} 

function timeFormat(seconds:int):String 
{     
    var minutes:int;     
    var sMinutes:String;     
    var sSeconds:String;     
    
    if(seconds > 59)
    {
        minutes = Math.floor(seconds / 60);
        sMinutes = String(minutes);
        sSeconds = String(seconds % 60);     
    } 
    else
    {         
        sMinutes = "00";
        sSeconds = String(seconds);
    }     
    if(sMinutes.length == 1)
    {         
        sMinutes = "0" + sMinutes;     
    }         
    if(sSeconds.length == 1)
    {         
        sSeconds = "0" + sSeconds;     
    }
    
    return sMinutes + ":" + sSeconds; 
}

/////////// CODE FOR THE TS24.COM LINK ///////////

ts24_mc.buttonMode = true;
ts24_mc.addEventListener(MouseEvent.CLICK, gotoTS);

function gotoTS(event:MouseEvent):void
{
    var req:URLRequest = new URLRequest("http://www.ts24.com");
    navigateToURL(req);
}

/////////// CODE FOR HIDING THE BOXING GLOVE WHEN ROLLING OVER THE SPEAKER ///////////

volume_mc.addEventListener(MouseEvent.ROLL_OVER, hideMouse);
volume_mc.addEventListener(MouseEvent.ROLL_OUT, showMouse);
stopSound_mc.addEventListener(MouseEvent.ROLL_OVER, hideMouse);
stopSound_mc.addEventListener(MouseEvent.ROLL_OUT, showMouse);

function hideMouse(event:MouseEvent):void
{
    removeChild(cursor);
    Mouse.show();
}

function showMouse(event:MouseEvent):void
{
    addChild(cursor);
    Mouse.hide();
}

stop();