how do I move a Array from a layout to another

0 favourites
  • 10 posts
From the Asset Store
Move Block
$10 USD
Captivating puzzle game. With challenging gameplay, this game will keep you very engaged.
  • Hi!

    Here's my problem.

    I have a array in layout2.

    My game starts with layout1.

    So I can't access or change data in my array in layout2.

    My Array is Global, but I guess that if it wasn't loaded at least once, I can't access it. anyway, it doesn't work.

    I'd like to do that, be able to access and change the data in my array.

    So I thought that I need to move the Array to layout1, but... how do I do that ??


  • you cant right now, dont know if that will change

    my solution was making a new array on layout one, replace all the actions with the new arrayobject

    the problem next is that you need to always launch from layout 1,

    therefore i used in layout2 > system compare if array.count=0 gotolayout 1

    and on layout1 you have a redirect to layout 2 or a button that connects to the other layouts

  • But i have too many actions...

    That's something missing also in Construct, if I may...

    The "replace" fonction.

    to replace an object by another in the Event sheets...

    That would be great!

  • There's a solution.

    Your main problem is that you put your Array in a layout that appear after the first layout that have to USE this array.

    Basically, you want to move the array to the other layout.

    1/ Save as Project in projectfolder (name it as you see fit)

    2/ Go to projectfolder/Layouts/

    3/ Open the xml file of layout where your array is

    4/ Locate it in the xml gibberish it should look like :

    <instance type="Array">

    5/ cut this

    6/ Open the xml of the layout you want your array to be

    7/ locate the nonworld-instances element

    8/ if you don't have non world element in this layout it should look like


    That's the syntax for empty element

    In this case you will have to change this markeup to


    To be able to put something inside.

    9/ paste inside the nonworld-instances element

        <instance type="Array">

    10/ save and close both xml file

    11/ open the projectfoler/project.caproj

    it should work...

    in any case you take no risk as you always have your original .capx

    also if you manage to get the hang of xml syntaxe, you can easily make some "replace" operation in the event sheet xml (projectfolder/Event sheets/)

  • wow nice tip, gonna look into that

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yep ! Thx, I'll try this!

    thx a lot!

  • It worked !

    Thx a lot !

  • The next build (r70) always creates global arrays on the start of the project rather than leaving it until you visit its layout. Hopefully that will also fix it.

  • I've seen that !

    It's great

  • Please please fix this bug. It is really trying and even with the hack fix of modifying the XML, it is still very tedious.

    <img src="smileys/smiley20.gif" border="0" align="middle" /> Of course the real fix is to make it so you don't have to have at least one instance in a layout to use it!

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