0 Favourites

Go To Random Layout

  • Hi All

    I've fiddled about with this but don't think its possible but can you go to a random layout

    with say an on clicked event.

    I'm looking to go to a random level at start of my game, wondered if above not possible, create

    a series of buttons each with a link to a specific layout then display one button at random instead.

    Interested in what people think.

  • Yes it's possible. You'd use something like -

    Sprite on clicked > Goto Layout (by name) > and then in the box use "Layout "&round(random(0,10))

    Or if you have changed your Layout names to something specific to your game, such as level names you could use the "choose" expression so:

    Sprite on clicked > Goto Layout (by name) > and then in the box use choose(emerald hills,underwater caverns,the end,the nether) this will randomly pick 1 value from the comma separated list.

    It just depends on how you have named your Layouts.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Thats great, got it working on a random button selection, but your method is alot cleaner.

    Many thanks

  • Yes it's possible. You'd use something like -

    Sprite on clicked > Goto Layout (by name) > and then in the box use "Layout "&round(random(0,10))

    Or if you have changed your Layout names to something specific to your game, such as level names you could use the "choose" expression so:

    Sprite on clicked > Goto Layout (by name) > and then in the box use choose(emerald hills,underwater caverns,the end,the nether) this will randomly pick 1 value from the comma separated list.

    It just depends on how you have named your Layouts.

    hey thanks alot it works

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