Array won't index Y axis through functions

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

    I am having a headache with setting the Z axis in an array. The issue seems to be that it won't use a function parameter for a Y index, even though it works fine for X axis.

    Anyway if you just look at the capx you should see what I mean. Run in debug mode and watch the array contents.

    You will see that when trying to reference the Y axis through the parameter it does nothing, but change it to a 1, which is what it should be in the other case, and it works. I have been scratching my head on this for hours and just can't figure it out!

    It's only a very small a straight forward capx, so if you could take the time to put some eyes on it I'd be grateful. It's part of a much, much bigger system and this is the one piece that won't work. I hope I've just been staring at it too long and it's something obvious to a fresh face.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You are trying to index with testArray("X","Y","Z"). You can't index with strings, you need integers.

  • blackhornet thanks, but I'm not trying to index with strings, I'm trying to index with the index of the string.

    This example pads out the X axis with more letters. As you can see, using that exact method it still chooses the correct position on the X axis. Now, try again but changing the index of Y to testArray.index(f.param(2)) - exactly as it is for X axis - and it no longer works.

    If I'm just not getting it, could you please show me an example? I have gone over it again after your comment and still I can't see the problem.

    EDIT: Oops, just read the manual more clearly. Index only works for X axis. Feeling silly! Sorry.

  • That's just what I was about to report.

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