Game building

Not sure how to ask this. I'm trying to figure out some terminology that has to do with game building and if Director class does what I think it does. In the forums, people talk about levels, stages, scenes, etc. So lets take Angry Birds as an example.

In LEVEL 1 of the game, there are 21 ... scenes? Stages? Levels? I'm thinking, after reading dozens of forum topics, that it's called a scene. Am I thinking of that correctly?

Level 1, Scenes 1 thru 21
Level 2, Scenes 1 thru 21
.
.
.
Level N, Scenes 1 thru 21

In my mind, I can create one GamePlay lua file that contains all of the game-play functions. And then I create the scene files, where each of these files contains all of the objects and variables needed for that particular scene within a particular level.

Now, instead of a generic level.lua file, I can use the director class as a template, basically, for every scene in the game. So I copy the contents of the Director class (or the contents that would work for my game) into all of the level/scene files. Then my game_play.lua file would get the objects and variables from the appropriate "director" file:

level1-1.lua (level 1, scene 1)
level1-2.lua (level 1, scene 2)
.
.
.
level23-20 (level 23, scene 20)

Is this a correct way of thinking about levels, scenes, and the Director class?

Thanks.

Gary

Hi Gary, I think you are doing some confusion here, let's go step-by-step.

When you open Angry Birds, there are some images of clickgamer and rovio. That can be a scene with 2 images using timers or 2 scenes one after the other. Then you have the main menu scene with the play button in the middle.

When you touch the play button, it goes to other scene where you can choose the level pack.
After choose the level pack it goes to another scene where now you can choose what level you will play.

Touching on level 1, it changes to a scene where a little animation will play and then changes to the game scene finally. Most of the time, scenes are the different screens that you are looking on the game. You can make it all in just one scene but is a hard word to do.

For best practices, you can make a flow (or tree) of the scenes like this:

intro
- menu
- - options
- - credits
- - play
- - - loading
- - - - game
- - - - - endgame

Now about the engine on a different file, that's very common and what most of us do. You can require the module with the engine inside the level files.

Director does the scene change control, you don't need to copy the code inside, just require it and use it. You can change it if you want but is not a good idea if you don't have a good knowledge of lua.

Yep, definitely confused. Thank you very much for your explanation. I've been trying to figure out what "scene" means. It's not quite analogous to a movie (because the opening and ending credits aren't considered scenes in a movie, but here they are considered scenes).

Instead, scenes are finite chunks of code that display and act upon one or more graphics. Depending on the needs of the app and preference of the programmer, every graphic displayed in an app could be its own scene, or a scene could contain multiple graphics along with the code that makes it do something.

So using your flow above:

"intro" is a scene, but it might contain just one graphic, such as the game's splash page, along with the code to make it display.

"game" is a scene that contains (more than likely) multiple graphics along with the code to make it do something. For Angry Birds, there are approximately 20 scenes per game level.

One scene, however, can (depending on the programmer's preference) be composed of one or more separate files.

Okay, now I'm going to go watch your tutorial for the third or fourth time to see how Director fits into this schema.

Thanks again.

Just a warning, one scene is just one file. You can use other files to store functions and use them on the scene, but a lua file is only a scene when it have the new() function returning a localGroup. Other files are simple modules like libraries or packages.

views:1572 update:2011/10/13 9:25:17
corona forums © 2003-2011