-1
\$\begingroup\$

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 :)

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

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

\$\endgroup\$
2
  • \$\begingroup\$ if the player won the level one, I will make a reading for xml of level 2 ? thank you very much \$\endgroup\$ Commented Apr 23, 2013 at 13:54
  • \$\begingroup\$ 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 \$\endgroup\$ Commented Apr 23, 2013 at 14:06
1
\$\begingroup\$

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.

\$\endgroup\$
3
  • \$\begingroup\$ can apply that on one frame ?? \$\endgroup\$ Commented Apr 23, 2013 at 0:59
  • \$\begingroup\$ Local, you serialize the level data inside a XML file or you can save a data structure. \$\endgroup\$ Commented Apr 23, 2013 at 11:58
  • \$\begingroup\$ 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. \$\endgroup\$
    – Ace
    Commented Apr 23, 2013 at 12:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .