Hi,
I’m developing a game in AS3 and I don’t know the best way to create the game structure. By structure I mean the states that the game will have, like:
- Intro screen
- Menu screen
- In-game screen
- End game screen
…
In As2 I used to put each state in one frame and call a gotoAndPlay to each one. This way, it was easy to apply transition effects like fades between states. But what about As3?
I’ve tried to create a complete class that I called ‘Main.as’, this class contais every function like: startGame, goToMenu, saveGame, etc. I’ve set this class as the Document Class and tried to call its methods from the frames like I used to do in As2. Well, it doesn’t work.
What is the best way to do this? I guess I have two option:
-
Use the Main class to handle the states and put it on stage. This is a good solution but how do I do the transition effects? And what about the company animation? In As2 when the animation is finished, it automatically jumps to the next frame, how is it done in As3?
-
Create an object from the Main class on the Timeline and call this object funtion in each state frame. This is like the As2 way of doing (that I was doing) but I’ll have to pass to the Main object the stage reference in order to addChild.
Well, how do you guys do that?
Thanks very much