Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Generate infinite levels

Discussion in 'Game Design' started by Fanto88, Nov 1, 2019.

  1. Fanto88

    Fanto88

    Joined:
    Nov 1, 2019
    Posts:
    2
    Hi all,
    I'm new to the unity community and I would like to understand how to create a feature. Actually, I m developing a 2D shoot em up game and I would like to create a system that has "infinite" levels. What I mean is, the map will be always the same, but the eniemes number will change every level. So, for level 1, the player should kill 10 enemies, after that the game should load level 2 (same map with different number of enemies). Is there a specific way to do that?
    For now, in my mind, I thought that I could just save the level number somewhere and everytime I load the map create X enemies depending on the level variable. Any better idea?

    Thanks, Davide.
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,766
    Hi Davide,

    Welcome to the Unity community! This will probably require at least a tiny bit of scripting. I recommend posting your question in the Scripting section.

    Design-wise, if the map is always the same, you can use the same scene. When the scene initializes upon loading, spawn a number of enemies based on the level count. When the player defeats all the enemies, increment the level count and reload the scene. You can get pointers on how to implement this in Scripting.
     
  3. Fanto88

    Fanto88

    Joined:
    Nov 1, 2019
    Posts:
    2
    Thanks for the reply. I think that I will be able to handle the scripting part, in case of any problem I will surely ask there. I was just searching for an idea :D thanks again
     
  4. TenKHoursDev

    TenKHoursDev

    Joined:
    Nov 9, 2014
    Posts:
    1,099