Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

which is easy and comfortable when programming a flash game levels. I ask this question for that because if I use frame to frame I will need to write code for each frame code area so the main class file.

Please forget this philosophy and give me a plan for game levels.

thanks in advance :)

share|improve this question

2 Answers 2

up vote 1 down vote accepted

You will have only two frames, Main menu with the levels, when you select a level you go to a frame with the game logic, so in the constructor (load method) you read the XML and create your level from it. Something Like

<Tiles>
   <ID>1</ID>
   <PATH>/tiles/t1.jpg</PATH>
</Tiles>
<Level>
   <Name> First Level </Name>
   <DataMatrix>
      <data x=0 y=0>1</data>
   </DataMatrix>
</Level>

Then what you need to do is to read this data, in the pos 0, 0 you load the tile 1

share|improve this answer
    
if the player won the level one, I will make a reading for xml of level 2 ? thank you very much –  Local Locas Apr 23 '13 at 13:54
    
Something like that, you can implement it in many ways. You can have a xml with level list, order and a folder for each level, then u load the XML inside this folder, put the tiles/sprites inside it. You can save the players data using a XML, when i created a level editor i used an approach like that –  demonofnight Apr 23 '13 at 14:06

you can simply store level data in diferent xml or custom format files.

i think this method is the most used one. in that way you are able to dynamicly change or expand levels as you like.

also it's important to know what kind of game you're talking about ?

for example, if youre dealing with tilemap based games, you would store level data like:

  1. tiles
  2. props and enemys
  3. triggers ( like level_end, or house_enter )
  4. images
  5. ...

and so on.

remember that you can store as many data as you need. so for example, you can have multiple layers of tiles, also you can store data for trigger points( like house_enter or level_end ) that defines the next level / house.

also keep in mind that you can store all those informations in diferent files, so every level has it's own directory where you can store images, informations and mapdata in sub directorys if you want.

the possibilities are endless.

share|improve this answer
    
thanks, where can I store the data? –  Local Locas Apr 23 '13 at 0:58
    
can apply that on one frame ?? –  Local Locas Apr 23 '13 at 0:59
    
Local, you serialize the level data inside a XML file or you can save a data structure. –  demonofnight Apr 23 '13 at 11:58
    
also please keep in mind to first get more familiar with overall game development and also with your chosen programming language, befor starting a big game project. this will save you much time and also a bunch of problems ( questions ) that you could solfe by yourself. –  Ace Apr 23 '13 at 12:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.