Save a random sprite choice for new layout?

0 favourites
  • 9 posts
From the Asset Store
Be quick and choose the right answer for the shown equation.
  • On start of layout I select one of five tiled backgrounds colours to display:

    System > On start of layout > System > Create object choose("Colour06","Colour07","Colour08","Colour09","Colour10") on layer "COLOUR" at (-100, -100)

    How would I then take whichever one was chosen into the next layout?

    Thanks all :)

  • Sorry, let make it clear.

    So you want to create tile randomly for every time you load layout, right?

    For another layout, you only put your event in the start of layout

    OR

    You put it in another eventsheet and include it in other ones.

  • In Event Sheet 1 on start of layout I choose a random tiled background (Colour06 ... Colour10) and display that in Layout 1. Then on Layout 2 I want whichever tiled background was chosen in Layout 1 to be used.

    So how do I pass through to Layout 2 the randomly selected tiled background from Layout 1?

  • If you want something like that, you will need a global variable to store the name of tileBG in Layout 1

    var randomTile(String)

    On Start Layout:

    Set randomtile to choose("Colour06","Colour07","Colour08","Colour09","Colour10")

    Create object randomTile on layer "COLOUR" at (-100, -100)

    Then you can move to Layout 2 and create the randomTile only

  • If you want something like that, you will need a global variable to store the name of tileBG in Layout 1

    var randomTile(String)

    On Start Layout:

    Set randomtile to choose("Colour06","Colour07","Colour08","Colour09","Colour10")

    Create object randomTile on layer "COLOUR" at (-100, -100)

    Then you can move to Layout 2 and create the randomTile only

    Thanks for this - but when I do this:

    It doesn't display any colours.

    Am I doing something wrong?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The second event:

    System > create object “BackgroundTile”...

    is create object by name.

  • The second event:

    System > create object “BackgroundTile”...

    is create object by name.

    Plus removing the “” doesn’t make any difference.

  • I have tested on my side and this work well.

    Can you run Debug and check the quantity of your tileBackground?

    I think it was created in somewhere in your layout

  • Managed to get it working - removed the "" from the second event:

    System > create "BackgroundTile" on layer "COLOUR"...

    so it now reads

    System > create BackgroundTile on layer "COLOUR"...

    I guess these are the "" you told me to remove initially - thanks for your help with this 👍

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