The web site for Flash ActionScript 3.0 game developers

 
         
   

Game Structure regarding classes and objects in Flash

Hi

Examples in the book are quite good, but I have some questions regarding game structure and creating my own classes. Hope someone can help me out.

1. Assuming that I cannot create AS functions (on a AS file) outside the bounduaries of a class, is it possible to create a class that I can use without creating an object instance? For example, I'm working on a collision detection class. Is is possible to just write CollisionDetection.checkSegmentCollision([arguments]) and get the result?

2. If I cannot do the above and I create a custom class not extending anything and therefor also create an object with it, how is it managed? When does it get deleted? Who owns it? All these questions seem obvious regarding display objects but to data objects and such, I'm a bit puzzled.

3. I'm used to work with objects that hold the info needed for all areas of the game. This means I usually have a gameState object, a playerState object and so on. Each object as a class with it's variables and methods. What would be the best methodology to create these objects and access it easily anywhere on the script?

I guess my questions

Thanks in advance.



Copyright Gary Rosenzweig