# Some Help/Opinions on OO design

**URL:** <https://forum.kirupa.com/t/some-help-opinions-on-oo-design/224729>\
**Category:** programming\
**Created:** [May 4, 2007, 8:21pm UTC](https://forum.kirupa.com/t/some-help-opinions-on-oo-design/224729 "2007-05-04T20:21:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rawness](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@Rawness](https://forum.kirupa.com/u/Rawness)\
**Post date:** [May 4, 2007, 8:21pm UTC](https://forum.kirupa.com/t/some-help-opinions-on-oo-design/224729/1 "2007-05-04T20:21:54Z")

</div>

Hello.

~BACKGROUND~

What has been completed so far:

[http://www.b3ta.cr3ation.co.uk/data/swf/harbinger.swf](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.

```auto
//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]
