Can the system randomly select the next layout?

0 favourites
From the Asset Store
A set of retro 16-Bit Neon UI elements to make your menus pop!
  • Hello,

    I have another few questions I've had trouble finding the answer to:

    1) How do I copy and paste a layout and event sheet?

    2) Is it possible to have the system randomly select the next layout?

    I would like to have it randomly pick the very first layout, and then have it randomly select the next layout is this possible, if so how do I go about it?

    Thanks again,

    Dave

  • Go to layout random(number of layouts)

    if index is 0 otherwise you know what to do

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi,

    1.

    i guess there is no way to copy all parameters of a layout into another one. would be a nice feature.

    but as solo layers click into the layout when all layers selectable -> ctrl+A ctrl+C

    new layout -> ctrl+V

    same for sheet.

    2.

    try

    + Every X Second

    -> Go To Layout ("layout"&random(3)) if you have layouts named layout2,3 etc.

    dont know if it works, but have fun trying <img src="smileys/smiley1.gif" border="0" align="middle" />

  • I guess that was what my problem is, I don't see where to make a new layout. I went to file,new, but it just opened a new project and the system events only shows layout 1

  • Just press the right mouse on the 'Layouts' folder icon on the right window and select 'Add Layout'.

  • We haven't done copy-pasting for some things yet (layouts is one of them) - it's surprisingly complicated to get working, since you can copy paste between projects and such. Should be fixed in a future build.

  • Go to layout random(number of layouts)

    if index is 0 otherwise you know what to do

    e

    I don't know where to find this. When I go to system -> go to layout, I just get a pulldown menu that show my layouts, and then I am only able to select one.

  • 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.

    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...
  • yeah, there is noway to add a script expression, just a pulldown menu.

    And idk there is a random function either yet.

  • Indeed, you can't "name" a layer, you have to choose it from the dropdown.

    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.

  • 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.

  • 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.

    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...

    Did I follow orrectly, here's a screen shot

    <img src="http://s855.photobucket.com/albums/ab120/daveryaaziem/action=view&current=screenshot.png" border="0" />

  • i855.photobucket.com/albums/ab120/daveryaaziem/screenshot.png

    oops here's the link to the screen shot

  • 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")

  • 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")

    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

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

    thanks

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