Random expression

This forum is currently in read-only mode.
From the Asset Store
Add this awesome sound effects to make your visual novel come to life!
  • I'm using Construct Classic R1 (not 1.1). I built 4 layouts, and in Layout 1 I input a random expression to randomly move to different layouts on a button press:

    Button B is down > + System Go To layout random(4) with transition 'None' lasting 0 MS

    Overall it works and does randomly jump, except for some reason it decides to close the window often instead of jumping to another layout. Is there something with the expression that could be causing it?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Random is zero based.

    Do you have a layout 0?

  • Could you rephrase that? I'm not certain of what you mean. I have Layouts 1,2,3 and 4.

  • zero based mean if you use random(4)

    the following number will be generated

    0 1 2 3 4

    so add +1 at the end like;

    random(4)+1

  • zero based mean if you use random(4)

    the following number will be generated

    0 1 2 3 4

    so add +1 at the end like;

    random(4)+1

    Okay I see. I initially tried to do something like (4+1) and was getting a better result but ultimately the same problem, I didn't think to go outside the parentheses with it for some reason. Thanks guys. Solved:

    How To Randomly Jump To Different Layouts

    <img src="http://farm3.static.flickr.com/2773/5715203234_4ac5a8c774_z.jpg">

  • if you use random(4), the following number will be generated:

    0 1 2 3 4

    Clarification: random(4) will give: 0, 1, 2, or 3

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