Forums → Programming Forum → programming levels
- 2 Replies
I have seen some really creative ways online to programming levels in your game. They pretty much fall under 3 basic methods.
Each level is on a frame, say the main screen is on frame 1 and you click to play level 3, the gotoAndStop function is executed and takes you to the frame level 3 is on (maybe frame 4).
pro's: very easy to understand and implement
con's: there must be code on each frame which puts a lot of extra effort on the programmer. Adding and removing listeners for each frame.
Each level is a MovieClip on 1 frame, and are invisible. So when you click on level 3 the code then would make the menu visible = false, and then level 3 visible = true
pro's: all the code is programmed in 1 frame with only 1 loop and is easier to keep organized.
con's: for each level all the variables will need to be reset to correspond to the level, otherwise the objective for level 1 will be active while you are playing level 3 and might have conflicting errors, resulting in a very lengthy code, not to mention all the code will be loaded for each level and will create lag.
Each level is a MovieClip and is not on the main timeline. If you click on a level to play, it will remove the screen, and then add the MovieClip containing the level.
pro's: The whole entire game is programmed in 1 function with only 1 loop, and specific parameters are loaded only when the MovieClip containing the level is loaded.
con's: While loading level 1 then moving on to level 2. Even after removing the MovieClip containing level 1, all the listeners that were present, still remain. So you will need to keep an eye on the listeners and remove them when they are no longer needed to keep the game play smooth with no lag.
All 3 of the methods work for both as2 and as3. There are a few other methods which I have not mentioned, like the method I use in as3, in which there is absolutely nothing on the main timeline and all the code is written externally in classes.
What method do you use?
I use Scenes, so that when I want to make a new level I just click Duplicate Scene.
I did that for a long time, works real good. Wasn't until I made the transition from programming in the actions panel to programming in classes that I haven't been doing it like that
You must be logged in to post a reply!
We strive to deliver the best gaming experiences... on the internet and on your mobile phone. Play thousands of free online games, get access to free mmorpg games, online rpg games, fun online flash games, and more.
We offer free flash games in many different genres: online shooting games, online puzzle games, online war games, free online car games, free online hidden object games and dozens more.
This is the best place on the web to play online games for free... play on Armor Games! No matter what game style you prefer, we've got it here.
Gaming websites, passionate bloggers, and quirky streamers are welcome to share or review our games. If you need game keys, art, trailers, screenshots or more check out our press kit website.
Game developer? Visit developers.armorgames.com to request AG developer status, find documentation on our APIs, and get access to our development environment. Let's make sweet, sweet games together.
Looking for a publishing partner that can help your app rocket to success? Contact the mobile team to learn more about how we can help!