array values not being set?

0 favourites
  • 6 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Hi,

    This is probably a very silly problem, but a problem nevertheless. For some reason after setting the value at (1,1,1) in my array, the .at(1,1,1) returns zero <img src="smileys/smiley5.gif" border="0" align="middle">

    Please see the tiny capx that i was trying to get to work...

    Since there's no way of console debugging (two plugins i found didn't work), i couldn't come up with anything better to make it work. Any help much appreciated

  • I cant check the .capx right now but Im assuming you didnt change the default size of the array, which is zero based, so try 1,1,0 or 0,0,0 and see if that fixes it! Right now you are writing to a z index which may not exist.

  • i thought i triple checked everything, here's a screenshot of the event sheet in question

    <img src="http://img6.imagebanana.com/img/vctmo2xs/Capture.PNG" border="0" />

  • When retrieving a numerical value for a string you may have to add int(). Try int(worldarray.at(1,1,1)) instead :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is a known problem in Construct 2: you inserted the worldArray object to a layout, deleted that layout, and now you can't use the object.

    When you insert an array an invisible instance is also added to the current layout. If you delete that layout the object then has no instances, so you can't store any data in it, but it still appears in events. You can tell this has happened because if you select worldArray in the project bar, it should have width, height and depth properties, but those properties do not appear. Your 'On array created' event will also not be running, because there is no array that gets created.

    I'm afraid for now all you can do is replace the object, or tweak the project XML to add the array to another layout. We're aware of this problem - I'll see if I can get something in the next build to make this clearer and easier to work with.

  • That'd be right, as int() didn't work, but replacing the object means slaughtering all events related to my array. Ah. I'll just wait for a new build and hope it's dealt with. It's not a huge deal to replug it all again but I'd love to make sure I don't accidentally delete a layout that has an invisible array in the future :) Thanks!

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