Some Help/Opinions on OO design

Hello.

~BACKGROUND~

What has been completed so far:

http://www.b3ta.cr3ation.co.uk/data/swf/harbinger.swf

[LEFT]Over the last several months I have been working on a flash 7 game. The game began rather small, and evolved into something a little more complicated. I then realized that creating an OO designed engine would be the best course of action for the following reasons.

  1. An automated collision detection system (i.e.) Add object to array -> collision detection handled.
  2. Relative ease in new addition of content (i.e.) Enemies and bosses can inheret certain traits.
  3. Reduction of redundant code.

I have been coding it for some time and have run into several problems that I have not been able to find a solution for.

~ PROBLEM ~

This problem arises from the difficulty I had in determining a way for all of my actionscript files to actually interact with flash (the .fla). I have a feeling that this is just a bad method for running the game.

The code that appears in my .fla. The issue is with mainThread.

//Initilization

var Level1 = new Game(this,100,8000,200);//Just creating a level and setting states
Level1.generateEnemy(15,0);
Level1.getPlayer().setCurrentCannon(0);

this.onEnterFrame = mainThread;
function mainThread(){
    switch(Level1.isRunning()){ // isRunning -- running / game-over / level done
        case 0 : //Game runs normally
            Level1.run();
            break;
        case 1 : //Mainchar is dead
            //
            break;
        case 2 : //Level Finished
            gotoAndStop("Level 2",1); 
            break;
    }
}//mainthread

The question I think I am trying to get at here is: if you have a “game” class, is the main thread a good way to run it?

As an ending note, I have been looking for quite some time for some source code of a large OO multiple level game. If anyone knows where some code is, it would help me a lot and I would really appreciate it.

Thank you for your time.
[/LEFT]