Problem with global array

0 favourites
  • 5 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • -I have a Array object (Foo) under my 'object types' that is set to 'Global: yes'

    -I have an event that sets the size of Foo to (5,5,1)

    -I have an "for each XY element" condition whose action for Foo is to set value at (Foo.CurX, Foo.CurY) to 7

    When I check my values (by updating text every tick), it says that Foo.Width is zero and Foo(3,3) is 0. Width should be 5, and the value of any cell should be 7.

    What am I doing wrong? I don't need to create an instance of my array, do I?

  • need capx

    ... Well as you made a clear description, I applied all you said in a capx and I have to say...

    It works fine so far (:

    ArraySetting.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah, I dumbed down my example a bit. I've got multiple layouts and multiple event sheets and stuff like that -- maybe the problem is somewhere there.

    I'll try simplify and repro the issue tonite, and check out your capx.

    Thanks!

  • Okay, check out this capx

    http://dl.dropbox.com/u/57805068/BrokenArray.capx

    I don't know how I did it, but one of the arrays (BrokenArray) doesn't have any instance variables or properties. And it's listed under Objects, but not under "All Layout 1 Objects". And that's the array that is gimpy.

    Maybe I don't understand something about object scope or something...?

  • I guess you created "BrokenArray" in a layout that you later deleted.

    What this means to C2 is that now BrokenArray has no "default instance".

    This make things bug on preview, it is a known issue that is to be fixed. (the "no default instance" part)

    I guess that your problem at first was that you were trying to use the array in a layout where it hasn't been instanciated yet.

    (For example, you're in layout1, you created brokenarray in the layout2 and you're trying to access it in an evensheet from layout1)

    I think like you suspect this is a scope problem.

    The best thing to do here is to create a new Array object in the current layout and simply delete "brokenarray" as unusable.

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