How do I go to a random layout

Get help using Construct 2

Post » Sat Jul 05, 2014 11:31 pm

hello all

example:
in my game i want to prepare like 10 easy level, 10 middle, 10 hard
when the game start you spawn in a random easy level, who gets you to a random middle who get you to a random hard.

so there is replayability.

but i dont know how to do that . in the events, i cant enter an expression, it must go to a specific layout.

thanks !
B
19
S
5
Posts: 104
Reputation: 1,761

Post » Sun Jul 06, 2014 12:10 am

You go to layout by name (Text). So just construct your layout names based on some numbering scheme, and construct the layout name Text in your Go to action based on your randomly chosen number or other expression.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Sun Jul 06, 2014 12:11 am

Hi,
name your layouts, for example: level0 level1, level2 etc.
Create a random number when wanting to go to your random layout, Then use:
System: gotolayout(byname) > 'level' & randomnumber.

happy constructing.
If it can be done, someone on the web will show you how to do it!

CDASI Games Mentality Break Splat-a-bug FlapFleet Challenge
B
34
S
12
G
7
Posts: 356
Reputation: 7,144

Post » Sun Jul 06, 2014 12:13 am

Haha, codah replied while I was replying...:)
If it can be done, someone on the web will show you how to do it!

CDASI Games Mentality Break Splat-a-bug FlapFleet Challenge
B
34
S
12
G
7
Posts: 356
Reputation: 7,144

Post » Sun Jul 06, 2014 12:19 am

Im sure there is a better way, but i know this way works at least.

https://www.dropbox.com/s/jkp0akef7mg5n ... ycler.capx

Create a global variable and name it something like Random_Gen

This will be a number you will be setting to a random whole number within a range (I.e 10)

In the example I use "Spacebar" to generate a random whole number between 1-3 using the "Choose" expression

I then have a global variable which handles increasing the difficulty which in reality is just pushing the event check down a notch into a different set of layouts to pick from.

so you have 1-3 easy, 4-6 medium and 7-9 Hard

I used 9 levels just to get the point across, but you can set the "choose" expression to something like this "Choose(1,2,3,4,5,6,7,8,9,10)" (no quotes or you will get a string)

I hope this helps!

Austin Morgan
Varia Games
B
20
S
2
Posts: 70
Reputation: 1,446

Post » Sun Jul 06, 2014 6:32 pm

great !! thats exactly what i needed! thanks a lot !
B
19
S
5
Posts: 104
Reputation: 1,761


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest