How do I make a door that goes to certain random layouts?

  • So there is a problem that I have run into and I can't seem to find a way around it. I know how to transfer the player from a layout to another layout once they touch the door but I don't know how to make it random.

    For example

    The player is on Level_1

    Once he touches the door at the end of the level the player goes to Level_31, not Level_2

    I want them to go randomly so its a different experience every time.

    The levels are handmade not randomly generated just so I'm not confusing anyone. I don't want the levels to be randomly generated just want the player to go to a different layout randomly every time.

    But I don't want the player to go back to the lobby so the layout must be Level_#. I just want the player to go to certain levels, not the lobby or main menu.

    If I need to explain more just ask but I hope that's enough. I would really appreciate your help.

  • Go to layout by name : "Layout_"&floor(random(low,high))

    where low= lowest layout number and high = highest layout number+1 (it rounds down)

  • I kind of understand what you are saying but when I copy "Layout_"&floor(random(low,high)) into the box it says Unknown Expression 'low' this is not a system expression or variable name in this scope. Is there a certain name that I have to give my layouts? Or do I have to only copy certain things? I did the go to layout by name block but its just the little error that is holding it back. Thanks for your help.

  • I mean replace low and high with numbers as described in the second line. I don't know what your range of layout numbers is.

  • Okay, now I know what you are talking about and I got it to work. Thanks so much for your help have an awesome day :).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Great, glad it's working :)

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