I've been having some trouble figuring out how to do this. My flash game is a zombie game where the character spawns the middle and at random times enemies spawn at the left or right of the screen coming towards the middle.
I'm not sure how to do this; I know this would involve using an array, but other than that I literally have no clue.
Some help would be appreciated.
Here is my code:
Actionscript Code:
package
{
    import flash.display.MovieClip;
    import flash.utils.Timer;
    import flash.events.TimerEvent;
    import flash.events.KeyboardEvent;
    import flash.events.Event;
    import flash.ui.Keyboard;
    public class ActualGame extends MovieClip
    {
        public var char:Character;
        public var zombie:Zombieclass;
        public var timer:Timer;
        private var speed:Number = 4;
        private var moveleft:Boolean = false;
        private var moveright:Boolean = false;

        public function ActualGame()
        {
            char = new Character();
            addChild(char);
            zombie = new Zombieclass(0,360);
            timer = new Timer(25);
            timer.addEventListener(TimerEvent.TIMER, zombie_spawn);
            stage.addEventListener(Event.ENTER_FRAME, enterframe);
            stage.addEventListener(KeyboardEvent.KEY_UP, keyup);
            stage.addEventListener(KeyboardEvent.KEY_DOWN, keydown);
            timer.start();
        }
        public function zombie_spawn(timerEvent:TimerEvent):void
        {
                addChild(zombie);
                zombie.zombie_move_right();
                //zombie_move_right makes the zombie movieclip move right across the screen
                if (char.hitTestObject(zombie))
                {
                    timer.stop();
                    removeChild(char);
                    trace("hit");
                }
        }
        public function enterframe(event:Event)
        {
            if (moveleft)
            {
                char.x -=  speed;
                char.scaleX = -1;
            }
            else if (moveright)
            {
                char.x +=  speed;
                char.scaleX = 1;
            }
        }
        public function keydown(event:KeyboardEvent)
        {
            switch ( event.keyCode )
            {
                case Keyboard.LEFT :
                    moveleft = true;
                    break;
                case Keyboard.RIGHT :
                    moveright = true;
                    break;
            }
        }
        public function keyup(event:KeyboardEvent)
        {
            switch ( event.keyCode )
            {
                case Keyboard.LEFT :
                    moveleft = false;
                    break;
                case Keyboard.RIGHT :
                    moveright = false;
                    break;
            }
        }
    }
}