Designing a multi level Space Invaders like game using Storyboard API.

Hello,

I’m working on a prototype of game similar to Space Invaders: http://www.otithelis.com/vidgames/space-invaders.jpg
The general idea is that there are some enemies in a group which move constantly from left to right and viceversa, and advance on Y axis, and there’s a ship which can shoot the enemies.

I noticed that for every new level the only thing that will change in the game will be the enemies. With a new level, new type of enemies will come with new abilities, like instead of just moving lef-right, to follow a bezier curve, to shoot from a different type of weapon, and so one. BUT, there will be also things that won’t change when advancing on every level, like the health bar, the score bar, the background image, the character controls, and even the collision handler won’t change.

And now I’m in a dilemma. I want to design every new level of the game in a separate Scene, but I don’t want to do things already done in Level 1, like to redraw the health bar, the score bar, recreate the collision handler and so one for every new Level.
On the other hand, I also don’t want to put all my levels in a single Scene, as this will increase the length of the code in a single file, and increase complexity as a consequence.

What would you advice to do in this particular situation?
Basically I want to setup all the general things in the Level1, and then all the subsequent levels to reuse some logic from here. And every new created Scene to have only code that describes how the enemies will act.

Thank you.

[import]uid: 180614 topic_id: 34380 reply_id: 334380[/import]

I had a similar question posted to my YouTube account for OmniBlaster, I suspect it might have been you. YouTube doesn’t allow for long comments, so let me elaborate here.

If I were to redo OmniBlaster, I would use storyboard to manage the menu, help, and other screens, and only have one “game” scene. For my game, each new level doesn’t bring unique code, but unique data. So you don’t actually need to leave the scene unless someone goes to the menu or something. Unless each level requires enough code differences, no need to write the same thing over and over. This is known as the DRY principle or Don’t Repeat Yourself.

Storyboard does have a reloadScene() feature which is good for restarting levels and such, but I’m not sure in a game like OmniBlaster I would do that, though in subsequent games I created an “in-between” level screen (a good place to show interstitial ads, so game progress, etc) then go back to the game scene to play the next level. If you can condense each level to data then you could have tables of information. You could also have level specific code that you keep in external modules (they don’t have to be storyboard modules, just modules in “require” in.

As for things that you don’t want to recreate (health bars and such) you can create them in main.lua and hide/show them as needed. Remember display objects/groups that are NOT inserted into a storyboard view are not managed by storyboard and stay on top of all storyboard screens.
[import]uid: 199310 topic_id: 34380 reply_id: 136677[/import]

Hi Rob,
yes, that was me who posted the comment on your YouTube account for OmniBlaster. :slight_smile:

“condense each level to data, and then have tables of information” - that sounds good, I’ll think if I can do that. Regarding the things I don’t want to recreate, I also like the suggestion of declaring them in main.lua.

Thank you for the help.

[import]uid: 180614 topic_id: 34380 reply_id: 136689[/import]

I had a similar question posted to my YouTube account for OmniBlaster, I suspect it might have been you. YouTube doesn’t allow for long comments, so let me elaborate here.

If I were to redo OmniBlaster, I would use storyboard to manage the menu, help, and other screens, and only have one “game” scene. For my game, each new level doesn’t bring unique code, but unique data. So you don’t actually need to leave the scene unless someone goes to the menu or something. Unless each level requires enough code differences, no need to write the same thing over and over. This is known as the DRY principle or Don’t Repeat Yourself.

Storyboard does have a reloadScene() feature which is good for restarting levels and such, but I’m not sure in a game like OmniBlaster I would do that, though in subsequent games I created an “in-between” level screen (a good place to show interstitial ads, so game progress, etc) then go back to the game scene to play the next level. If you can condense each level to data then you could have tables of information. You could also have level specific code that you keep in external modules (they don’t have to be storyboard modules, just modules in “require” in.

As for things that you don’t want to recreate (health bars and such) you can create them in main.lua and hide/show them as needed. Remember display objects/groups that are NOT inserted into a storyboard view are not managed by storyboard and stay on top of all storyboard screens.
[import]uid: 199310 topic_id: 34380 reply_id: 136677[/import]

Hi Rob,
yes, that was me who posted the comment on your YouTube account for OmniBlaster. :slight_smile:

“condense each level to data, and then have tables of information” - that sounds good, I’ll think if I can do that. Regarding the things I don’t want to recreate, I also like the suggestion of declaring them in main.lua.

Thank you for the help.

[import]uid: 180614 topic_id: 34380 reply_id: 136689[/import]