go to random layout

  • hi everyone. how can i make that if the player collide sprite. the sprite will take him to random layout between some options?

    for example: if the player in layout 1 have collision with sprite, the sprite will take him to layout : 2 or 3 or 4.

  • Easy. "On collision with Sprite -> go to layout by name -> choose("layoutname1","layoutname2","layoutname3"). Use as many names as you need.

  • Easy. "On collision with Sprite -> go to layout by name -> choose("layoutname1","layoutname2","layoutname3"). Use as many names as you need.

    Great solution! now here is the hard way:

    On collision with Sprite -> go to layout by name ->"layoutname"&int(random(1,500))

    That will pick from anything named layoutname followed by a number between 0-501.

    substitute 500 with the total number of layouts you have.

  • So is "choose" just an action built into Construct 2 that will always perform a random variable name in any event it's found?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So is "choose" just an action built into Construct 2 that will always perform a random variable name in any event it's found?

    Really handy if you have to choose from a bunch of string variables (text), or if you have a bunch of non-sequencial numbers to choose from.

  • Easy. "On collision with Sprite -> go to layout by name -> choose("layoutname1","layoutname2","layoutname3"). Use as many names as you need.

    thanks

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