Array layout scope

0 favourites
  • 6 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • Hey,

    I've been occuring a strange behaviour in r50.

    I have two layouts in my app.

    I tried to fill an array with values from a layout, and use those values in the other layout.

    From the second layer, it seemed the array was empty (only returning 0) whereas from the first layout, it was obvious the array was filled. (the array contained different values).

    I had created/added my array to the first layout.

    I've tried a bunch of stuff around, questionning my code, etc...

    In the end, I resolved to put the filling code in the same layout/eventsheet that the code which gets infos from the array. And there, either filling and getting values did not work.

    Last solution, adding a new array to my second layout (containing the fill and get code) and all work as intended.

    So it seems the array only applies to the layout it is added to.

    There's no "global" option for the arrays and no way to tell which is their layout of of belonging.

    Have I missed something, is it intended behavior ?

    Is this already had been spotted and resolved in upcoming r51 ?

    I was kind of hoping r51 would be out when I'd wake up today (^^).

    Anyway, I thought I would post it and wait for Ash explanation.

    On another note, I have been intensivly using C2 during this week end for the Ludum Dare (I'm still on for the "Jam" entry) and I must say that it has been gladely stable. I've only occured a few bugs (already known and that I should have avoided) and in the whole, it it a nicely reliable tool.

    I love the fact that globals var now are just "name_of_var" no more tedious Global["my_var"] or whatever method of CC.

    It is just a blast.

  • Right now there's no Global feature - so all objects (including Arrays, but excluding 'single globals' like Keyboard and Mouse) are destroyed at the end of the layout. I haven't got Global for r51 I'm afraid but I'll try get it done for r52!

  • Ok, then that makes perfect sense.

    I only wished I hadn't had to learn it "the hard way" <img src="smileys/smiley2.gif" border="0" align="middle" />

    Keep up the good work anyway.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is this still in progress? I would love to be able to transport my inventory array between layouts.

    I am thinking I might be able to get away with reconstructing the array between maps by using a FOR EACH with a "Pipe" delimiter...

    Something similar to

    ArrayPass0 = ArrayPass0 & "|" & MenuArray.At(MenuArray.CurX,MenuArray.CurY,MenuArray.CurZ)

    Then for each on paramater of xyz for

    tokenat(arraypass0, loopindex+1,"|")

    ...on the other map

    No luck yet.. but thats my ideaw

  • Gillis: This is a very old thread.

    Arrays now have the global property.

    Be sure to create the original instance on the first layout you will visit, set the "Global" property to yes and from there your array is accessible from any layout.

  • OK. Somehow it bogs the cpu down when I go global. Let me double check a few things. r87

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