Multiple Stages/Levels & Saving Progress

1 favourites
From the Asset Store
Progress\Loading Bar. Now Load you game like a Professional.
  • 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.

  • 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.
  • 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.

  • 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

  • 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?

  • 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.

    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.

  • 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.

  • 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.

    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;

    which are passed on to the main event sheet.

    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.

  • 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.

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

    I will definitely be doing this though:

    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.

  • - 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

    Where do I find more about this, can't find anything about global layout. Can imagine that with events I can create touch objects with events and set their position and size on start of the layout. Is that only way?

  • enyon, sorry, that was poor phrasing on my behalf. There are no "global layouts". I was referring to the idea of having a dedicated layout just for the UI, which is filled with global objects.

    If you decided to instead create your UI with events, those should all be along the lines of System: On start of layout -> System: Create(objects).

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • enyon, since this has come up a few times recently, I decided to finally write a tutorial on making a global UI. Check it out here.

  • Yay, Thank you!

  • Hello, I'm making a game with several stages, and what I want is that when you reach a punctuation change to another layout.

    What I have done as I have in the picture, but the game is crazy. I restored global variables, to test, but still the same.

    dl.dropboxusercontent.com/u/127488641/PARA%20COMPARTIR/2013-08-15_11-26.jpg

    Puedeis I would say as I thought it was that easy, but it is complicated.

    Thank you.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)