I'm working on a random wave system for a game. The idea is that every 1000 points a movement pattern would be selected from around 50 possibilities. This would affect the speed, direction, and image of the selected item. I have devised a method that I think will work, but I'm unsure if this is going to cost too much memory to run.

```
public class engine extends MovieClip {

    private var countK:Number = 0;
    private var newWave:Boolean = true;

    public function engine() {
        stage.addEventListener(Event.ENTER_FRAME, update);
    }

    private function update():void {
        checkCount();
        checkNew();
    }

    private function checkCount():void {
        if (count => 1000) {
            newWave=true;
            count = 0;
        }
    }

    private function checkNew():void {
        if(newWave) {
            randomNumber();
            newWave=false
        }
    }

```

Above is my quick idea of getting a random number to be generated every 1000 points. Points can be added in any way you want (just add say 20 to "Score" and 20 to "count" at the same time). Where I can a random number function in checkNew, I won't be pulling another function, it's simply there for the sake of legibility. 

```
                            var newEnemy:mEnemy =new mEnemy();
            stage.addChild(newEnemy);
            EnemyArray.push(newEnemy);
            trace(EnemyArray.length);

```

Above is some code that can add an instance of mEnemy to the stage. Now where I'm starting to loose it is, how can I translate the random number into a viable method of changing mEnemy's behaviour? 

Is it wise to have 50 functions inside the mEnemy class and just before I addChild, I do something like newEnemy.WAVEfuncton1(); ? If that is the case, can I save code by getting it to select the function without writing a whole bunch of if statements? 

Instead of; 

```
if (randomN==1) {
newEnemy.WAVEfunction1();
}
if (randomN==2) {
newEnemy.WAVEfunction2();
}
....

```

Can I do;

```
newEnemy.WAVEfunction[randomN]();

```

This is also assuming that using functions inside the enemy is the best idea. Is it better to have the behaviours inside the engine class instead? 

As you can see, I'm no programmer. I'm very new to this sort of thinking and I don't want to create a mistake that will destroy the performance of the game (not to mention picking up bad habits too!). 

If you have taken the time to read this question, thank you! If you tolerate my ignorance, then thank you even more!