Go To Random Layout

Get help using Construct 2

Post » Tue Jun 10, 2014 7:19 am

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.
B
6
S
1
Posts: 18
Reputation: 342

Post » Tue Jun 10, 2014 7:38 am

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.
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Post » Tue Jun 10, 2014 7:49 am

Thats great, got it working on a random button selection, but your method is alot cleaner.

Many thanks :)
B
6
S
1
Posts: 18
Reputation: 342

Post » Thu Apr 27, 2017 12:12 am

Minor wrote: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 :) :D
B
10
S
2
G
1
Posts: 4
Reputation: 1,058


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 33 guests