Multiple Stages/Levels & Saving Progress

Get help using Construct 2

Post » Sat Jun 22, 2013 7:41 am

Hello, I am trying to create a simple game that is consisted of multiple stages in the game (80+ stages). Does this mean I will need over 80 layouts in my game?

When the player reaches the end, I want them to go to the next level.

And if they decide to quit and come back later, I want them to be able to resume where they left off (a save system), or pick a level they have already beaten.

I've searched for many tutorials but I couldn't find anything that is this specific. Help?

Thanks.
B
5
Posts: 8
Reputation: 810

Post » Sat Jun 22, 2013 9:08 am

There are many ways to do this, but I'll give you a breakdown of how I do it:

- One layout per level.
- Create a global UI layout which is only visible and active in a level. The prevents you having to recreate your UI in every layout (a major pain if you want to adjust it later). Alternatively, create your UI at runtime with events.
- Use a few global variables to record your progress (Score, CurrentLevel, UnlockedStuff, etc.).
- At the end of each level (or in the score screen, if you have one), chuck all the important global variables into WebStorage, then wipe all of them. Restore the important ones back from WS.
- Jump to your next level.
- In your main menu, have an option for new game (starts at level 1, wipes WS), or continue game (checks if there's WS, if there is, populate the global variables and carry on from CurrentLevel). Use a level selection screen based on the value of CurrentLevel.
B
57
S
15
G
11
Posts: 912
Reputation: 12,626

Post » Sat Jun 22, 2013 9:12 am

Woah! Thankyou, GeometriX, for the nice breakdown :)

I will definitely take note here and try to learn how to implement all the stuff you just said.
B
5
Posts: 8
Reputation: 810

Post » Sat Jun 22, 2013 12:30 pm

You can create multiple levels based off of one layout. Think the old electronic handhelds by Tiger or Bandai back in the 80's as an example. Depending on the user's level (global variable) the amount or type of enemies, power-ups, terrain features are added or subtracted from the layout. To save or load it just assign the global variable.
http://upload.wikimedia.org/wikipedia/en/e/ee/Mega-Man-2-Tiger-small.jpg
B
22
S
9
G
3
Posts: 203
Reputation: 3,653

Post » Sat Jun 22, 2013 11:46 pm

So, if I keep on creating multiple levels using one layout, won't everything become cluttered? So, then won't I just end up with 80+ layers instead of layouts?
B
5
Posts: 8
Reputation: 810

Post » Sun Jun 23, 2013 12:31 am

I think it depends on the type of game you're creating as to whether or not you think having a main event sheet is going to cause clutter. This is where creating groups becomes very useful; gets rid of all that clutter by grouping together related events.

I think you may be getting layers a bit confused there, though. You don't need a layer for every level. Layers are for seperating types of objects on your layouts; sprites on one layer, background on another, text on another, etc. You wouldn't store seperate game levels on them. That's what layouts are for.

You can have multiple layouts share a single event sheet, or each have its own event sheet, or each have its own event sheet, and include other event sheets.

You can set each layout to a single event sheet if you want, or have every layout have its own event sheet.

A better way to do it, personally, would be to store all your main game events in a single event sheet, but then have a seperate event sheet for each level to do all the things that are going to change per level. To include your "main" event sheet in every layout, you can use "Include event sheet" in each level event sheet.

https://www.scirra.com/manual/121/event-sheets

If, however, all that's going to change each level is where you place your objects, then there's no reason that you couldn't do it all via a single event sheet.

I, personally, would start with one event sheet, until my project got large enough that I could see that there were some events that rarely or never changed (these would become part of my main event sheet), and other events that were being repeated, or changed for each level. These would become my event sheets for each new level.

If you're finding yourself changing the same variables over and over again each level, then that'd be a good reason to have one main event sheet, seperate event sheets for every level (aka layout), and include your main event sheet on every level event sheet.Nullus2013-06-23 00:36:43
B
3
Posts: 23
Reputation: 221

Post » Sun Jun 23, 2013 10:42 am

@Nullus, agreed. I forgot to mention how I handle event sheets. I create a single, all-encompassing event sheet that contains basically anything that's likely to happen more than once across my levels. This includes player controls, UI, enemy interactions and debugging.

I then create an event sheet per level to handle that particular level's parameters (enemy spawn rate, enemy types, total number of waves, etc.) which are passed on to the main event sheet. Each level event sheet includes the main event sheet.

I also put all my global variable in their own event sheet, just to keep things neat.
B
57
S
15
G
11
Posts: 912
Reputation: 12,626

Post » Sun Jun 23, 2013 1:31 pm

[QUOTE=GeometriX] @Nullus, agreed. I forgot to mention how I handle event sheets. I create a single, all-encompassing event sheet that contains basically anything that's likely to happen more than once across my levels. This includes player controls, UI, enemy interactions and debugging.

I then create an event sheet per level to handle that particular level's parameters (enemy spawn rate, enemy types, total number of waves, etc.) which are passed on to the main event sheet. Each level event sheet includes the main event sheet.

I also put all my global variable in their own event sheet, just to keep things neat.[/QUOTE]

I agree that this is a good apprach to handling larger games.

Would you mind elaborating a little further on this point, though? I'm interested in what you meant by;

[QUOTE=GeometriX]
which are passed on to the main event sheet.[/QUOTE]

With my current project, I'm planning to take the approach of using spawn points, storing spawning behaviour via instance variables, and then using each individual level's event sheet to change those instance variables after the first wave, up until the final wave.

I'm a stickler for efficiency, so any advice on the best way to take advantage of multiple event sheets is of great help.


B
3
Posts: 23
Reputation: 221

Post » Sun Jun 23, 2013 1:41 pm

@Nullus I've used this same approach in a wave-based TD game. So, in each level's event sheet I set the enemies that are allowed to spawn, the number of waves in that level, and the number of enemies per wave.

In the main event sheet, I have a few events that handle the actual spawning of enemies. So, it checks what enemies are allowed to spawn (based on the level's event sheet), then it spawns those enemies, adding 1 to a counter every time a permitted enemy is spawned (not-permitted enemies are simply destroyed off-screen, until a permitted one comes along).

When that counter reaches the previously determined permitted number of enemies (level's event sheet), it clears the board and adds 1 to the current wave count. When that wave count matches the previously determined number of waves (again, from the level's event sheet) and Enemies.Count=0, then the level is considered to be complete. Store and reset global variables, and jump to the next layout with its own event sheet.
B
57
S
15
G
11
Posts: 912
Reputation: 12,626

Post » Tue Jun 25, 2013 7:29 am

Just read all your guys' replies... there really should be a tutorial for handling multiple levels haha.

I will definitely be doing this though:

[QUOTE=GeometriX]
I then create an event sheet per level to handle that particular level's parameters (enemy spawn rate, enemy types, total number of waves, etc.) which are passed on to the main event sheet. Each level event sheet includes the main event sheet.[/QUOTE]
B
5
Posts: 8
Reputation: 810

Next

Return to How do I....?

Who is online

Users browsing this forum: sean080 and 9 guests