Hi guys,

I'm currently making a 2D shoot em up game where each enemy created will follow the player around the level. I'm wondering for any suggestions or code tips on how to make the enemy AI/movement randomise and also to make the enemies stay away from each other as there is only collision setup between player vs enemy, not enemy vs enemy. Here is my code I've done so far for enemy AI:
Actionscript Code:
public class MainShapeShooter14 extends MovieClip
   {
public var level:int = 1;
public var enemies:Array;    
 private var _randomX:uint;
    private var _randomY:uint;
private var maxEnemyStep:int = 2
var _timer:Timer;

public function MainShapeShooter14()
_timer = new Timer(5000);
enemies = new Array();
    makeEnemies();

public function makeEnemies():void{
   _timer.start();
   for(var i:int = 0; i < level; i++){
     var tempEnemy:Enemy = new Enemy();
     addChild(tempEnemy);
     var randomXPosition = Math.round(Math.random() * stage.stageWidth);
    var randomYPosition = Math.round(Math.random() * stage.stageHeight);
    tempEnemy.x = randomXPosition;
    tempEnemy.y = randomYPosition;
   
enemies.push(tempEnemy);
    tempEnemy.gotoAndStop(1);
     addEventListener(Event.ENTER_FRAME, onEnterFrame);
     tempEnemy.addEventListener(Event.ENTER_FRAME, onEnemyMove);
    _timer.addEventListener(TimerEvent.TIMER, onUpdateTime);
     }
    }
 function onEnemyMove(event:Event):void{
    var enemy:Enemy = Enemy(event.currentTarget);
     var xDiff:Number = player.x - enemy.x;
     var yDiff:Number = player.y - enemy.y;
   
    //if they are further than maxEnemyStep away in x
     if (Math.abs(xDiff) > maxEnemyStep){
        if (xDiff < 0){
          xDiff = -maxEnemyStep;
        }else{
          xDiff = maxEnemyStep;
        }
     }
     //if they are further than maxEnemyStep away in y
     if (Math.abs(yDiff) > maxEnemyStep){
        if (yDiff < 0){
          yDiff = -maxEnemyStep;
        }else{
          yDiff = maxEnemyStep;
        }
     }
     enemy.x += xDiff;
     enemy.y += yDiff;
     xDiff *= _friction;
     yDiff *= _friction;
     enemy.gotoAndStop(1);
    }

Thank you for your time and reading all that and any help/suggestions would be greatly appreciated.

Jonesy