Level Concept
I had some concerns of how to replicate game states, or levels and wanted to figure out how to do it before I started. I wanted a Menu state, a Game state and a Game-Over state; that's what Helicopter required.
After some Googling, I came across the right concept and a previously answered question that told me just what I needed to know.
Question
What are best practices to add gameplay, to specific level? I have some event types, and my game logic now looks like. OnEnterSensor is virtual and is different for each level(01,02 ...). Game type platformer and what about other types of games and their logic description.Answer
The data you loaded and parsed can be accessed just as you've indicated, using standard conditional logic. If you're looking for conciseness, there are other ways to do conditional logic:
- switch keyword is one (found in most imperative-style languages), while the ?: operators are another. Neither is much more elegant than if, except for small sets of conditionals.
- There is a more elegant way that takes two forms: function pointers (also known as "functors" or in C#, "delegates"), or the structural equivalent frequently used in OO languages, the Strategy Pattern.