How do I create a randomly generated world?

1 favourites
  • 4 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • This is my first time using these forums, so please let me know if I did something wrong. I'm trying to make a catacomb-like dungeon. Each room has multiple spawners which will spawn either a button, keyhole, lever, or key to continue the adventure. I'm trying to figure out how to get the game to randomly spawn a button, keyhole, lever, or key on each spawner. I also want to make sure the game remembers the generation pattern it created in case the player retraces their steps. There's also a point where the game will soft reset (buttons, keyholes, levers, and keys will return to their original positions, but the location of those buttons will stay the same as they were randomly generated.) The room layouts won't be the same as the layout they were before the soft reset. I know this sounds really complicated, but any help I can get will be fantastic! Thanks so much :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I figured it out! I used a global variable and assigned each object a number. I used round(random(1,3)) 1 being the key, 2 being the lever, and 3 being the button! :)

  • Don't use round with random, it will produce uneven results. Value 2 will be picked more often than 1 or 3.

    Use int(random(1,4)) instead, or choose(1,2,3)

  • Thank you! I used the choose event, and got fairly equal results when I tested it a few times! I'm glad, because I was getting a lot of the same item while testing earlier :D

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