Can the system randomly select the next layout?

Discussion and feedback on Construct 2

Post » Tue Aug 09, 2011 10:57 pm

[QUOTE=Kyatric] Indeed, you can't "name" a layer, you have to choose it from the dropdown.
[/QUOTE]

i guess u mean layout. and yes you can name them, just like event sheets. right menu -> Projects -> layouts -> select and then left menu -> name.

so my way 'could' work too. didnt test it. your way is working fine.
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Tue Aug 09, 2011 11:08 pm

By "naming" (in quotes) I meant type their name directly as expression in the action window. (impossible in C2 atm, you can't right click the dropdown to change it to a text input)
And yes, I meant layout (I'm not mixing the notions, just went to fast in writing it :P)

Thanks for the noticing, I edited my previous post.Kyatric2011-08-09 23:09:52
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Tue Aug 09, 2011 11:16 pm

[QUOTE=Kyatric] Indeed, you can't directly type a layout name, you have to choose it from the dropdown.
Then do a little workaround.

Randomize a number and test it.
[code]Global variable rd as number (= 0 default)
System->Start of layout - Action System-Global & local Variable - Set value
Variable: rd - Value: round(random(your_number_of_layouts)+1) (round() will give an integer) (+1 to prevent obtaining 0 as result of the random())
..SubEvent System-Compare Variable
..Variable: rd - = Equal to - Value:1
...Action: System - Go to Layout, pick your layout 1

..SubEvent System-Compare Variable
..Variable: rd - = Equal to - Value:2
...Action: System - Go to Layout, pick your layout 2

etc...[/code]

[/QUOTE]


Did I follow orrectly, here's a screen shot

B
6
S
1
G
1
Posts: 52
Reputation: 829

Post » Tue Aug 09, 2011 11:17 pm

http://i855.photobucket.com/albums/ab120/daveryaaziem/screenshot.png

oops here's the link to the screen shot
B
6
S
1
G
1
Posts: 52
Reputation: 829

Post » Wed Aug 10, 2011 1:21 am

The "randomLayer = 3" and "randomLayer = 4" should be subevents from "on start of layout", not subevents of "randomLayer = 2".
(all the tests on the same level, as subevents of "On start of layout")
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Wed Aug 10, 2011 1:59 am

[QUOTE=Kyatric] The "randomLayer = 3" and "randomLayer = 4" should be subevents from "on start of layout", not subevents of "randomLayer = 2".
(all the tests on the same level, as subevents of "On start of layout")[/QUOTE]

Thanks for your help,

I made the changes, however I still cant seem to get the game to randomly select the layouts

Here's an updated screenshot

http://i855.photobucket.com/albums/ab120/daveryaaziem/screenshot2.png

thanks
B
6
S
1
G
1
Posts: 52
Reputation: 829

Post » Wed Aug 10, 2011 2:59 am

As you only have 4 layouts the formula should be "round(random(3)+1)".
I've tested the setup as you have, it works.

I made 4 blank layouts, just putting a text object in them, and setting its text to the layout's name.
When actualising/reloading the preview, I obtained a different layout on start of the app.

The code we are talking about should be sitting in the first layout that's executed.

It should work.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 8 guests