1
\$\begingroup\$

I'm building a game in Flash similar to the structure of Angry Birds or Cut the Rope (where there are a number of "rooms" and unique levels created within each "room").

The user gets through the game by playing through a room to unlock the next room. I have all the logic to unlock rooms and move between them. The problem I've come to is that I'm not sure how to build out the levels in each room. Let me provide an example.

Let's say I have 15 rooms. Each room has 10 levels, each with their own objects whose attributes change as the levels increase (ie. speed, position, collisions). There can be 2 to 5 objects out of a possible 10 that are randomly generated and placed on the stage, each level. This all adds up, with so many combinations and a total of 150 levels.

Ideally I would like to use a single class that controls the level creation for all rooms. Right now I have a Menu Class, one Class for each room to build the background, one LevelCreation Class, and one for the pause/lose menu. Does this seem like a feasible Class structure? Or should there be a LevelCreation Class for each room?

Switching between levels, re-initialize existing structure or create new one? is sort of helpful in reusing objects when advancing from level 3 to level 4, but I'm lost on how to set up the individual levels. So as a second part to the question: in my LevelCreation class(es), what is the best way to store the level attributes? In an array (or multiple arrays)?

I've also taken a look at How should I manage game levels in a flash games? but it seems to focus more on save/load data and not on how to build the levels. Structuring various game states and unique levels seems to be the closest I could get to an answer, but I guess I'm too much of a noob to quite understand what the answer to the question is saying.

I hope this all makes sense and I appreciate any help that I can get. Please let me know if I need to provide more details.

\$\endgroup\$
  • \$\begingroup\$ How about RUBE? \$\endgroup\$ – wolfdawn Apr 28 '14 at 19:13
  • \$\begingroup\$ I think this is for far more complex games than mine. I'm not building a platform game. Think of the scene set up like cut the rope, where your are looking straight on - no panning. Super basic, just lots of levels. Everything I'm finding is for building puzzles or tile games. I really would like to avoid having a function for each level if possible. \$\endgroup\$ – mintfiend Apr 29 '14 at 23:50
  • \$\begingroup\$ Well normally if it's very simple, you could use XML or JSON. Regardless, I'd rather use RUBE to design a physics game level. I think it makes complicated things easier. How are you storing your game level data now? \$\endgroup\$ – wolfdawn Apr 30 '14 at 22:05
  • \$\begingroup\$ I am just starting to build it out and haven't gotten to that point. Right now I'm just trying to focus on the general outline of the code and how all the pieces will fit together. It does seem like XML would be my best option thus far but I have no experience bridging AS and XML so I will need to dig deeper into that. Any resources would be helpful. \$\endgroup\$ – mintfiend May 1 '14 at 14:31
  • \$\begingroup\$ The best book I know is the Action Script Bible. It has a lot of useful examples you may be able to find online. The XML handling functionality is very robust in AS3 so you should feel right at home once you get the hang of it. \$\endgroup\$ – wolfdawn May 1 '14 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.