How do I do Pseuo-Random levels? Random but no repetitions.

0 favourites
  • 8 posts
From the Asset Store
Unlock Levels, Worlds & skin plus add coins by watching ads
  • Hello all! First time poster here and would like some help.

    Let's say I have 20 levels at the moment and I want the game to randomly load another level after one is completed. BUT, I do not want it to repeat the same levels. There are several occasions where it would load the same level again, and it'll get repetitive for players.

    Right now this is what I have:

    Go to layout "Map "&floor(random(Number_of_Maps)+1)

    This is the event for when you start a game, so it randomly loads a level from (1-Number_of_Maps), Number_of_Maps being a Global Variable I have. This event also happens once you complete a level, it randomly loads another. Once a level is loaded though, I want it to be out of the selection pool so that we don't return to it again.

    If you curious what my game is, it is a top-down local multiplayer game with battle tanks.

    Thanks for helping me out!

  • Put all possible level numbers in an array. Then chose a random index of the array, go to the level of the array value and delete that index from the array (so it can't come up again when you select levels the next time).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just a quick tip:

    A great way to automatically generate a seed for your random number picker, is the time it takes the user to press the "Start button" at the beginning of the level.

    Also wanted to say I love your explosion animations :3

  • Thank you everyone, I'll give it a go and see if it works.

    Also wanted to say I love your explosion animations :3

    Thank you :3

  • If you want to enhance it, make pieces of the tank that look broken, and add the "bullet" behavior with bounce enabled. Then On Created ---->set angle: int(random(0,360)).

    They will fly apart,and bounce off solids when they spawn

    Cool looking game, reminds me of Combat for the Atari 2600, The worlds very first home console "Bro-Game" in cartridge form.

  • If you want to enhance it, make pieces of the tank that look broken, and add the "bullet" behavior with bounce enabled. Then On Created ---->set angle: int(random(0,360)).

    They will fly apart,and bounce off solids when they spawn

    Cool looking game, reminds me of Combat for the Atari 2600, The worlds very first home console "Bro-Game" in cartridge form.

    This is perfect!! Thank you! I just improved the animation sprites of my explosions and I wanted to add giblets. I just figured I'd just make them as animated sprites but your suggestion is much better. It'll make the destruction more physical since it'll bounce of the walls.

  • I need to bump this since I don't want to make a new topic.

    But I need help with this arrays. I'm still learning Consttruct 2 and haven't delved into learning arrays yet.

    I've tried looking at tutorials but it still confused me.

    How do I pull numbers from an array that will load a level? And how do I remove the number that has been used?

    Basically, I don't know how to do random level loading without repetition.

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