Issues with selecting by Z in array

0 favourites
  • 4 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • Hey, I apologise if I am asking something entirely noobish, but I've just been playing around with Construct 2 recently so not 100% on everything just yet.

    Basically, I am storing block placement in an array and calling that to create the levels, it's all well and good, the level displays perfectly but there is a small problem.

    You see I want to have multiple possibilities for levels, so using a third dimension to the array, but I am having an issue calling the specific array I wish (or rather at random).

    I hate to ask, but what would you guys suggest for calling a specific Z-field in an array? Because nothing I can think to try is working.

    Many thanks.

    -Silent

  • It all depends on how you access your array when you create your levels. Could you detail a bit on what you are currently doing and what or how it goes wrong ?

  • Thanks for the reply Magistross, I seem to have got it working now, but it just doesn't seem the most straight forward of ways.

    Essentially at start of Layout I am creating n array the size of my game (25 blocks by 20 blocks) with a depth of 2.

    I was then assigning half dozen fields in the array to 1.

    Next For Each XY element, with a sub-event for Value at Array.CurX, Array.CurY, Level (numerical variable) = 1, I am creating an object and assigning the frame of that object to display what I want.

    Now all the tiles on Depth-0 were displaying correctly but only two tiles on Depth-1 were showing up, I noticed that the tiles that were showing were sharing space with tiles on Depth-0, so I've set Depth-0 to all tiles and am exempting that from my results, and everything else seems to be working fine.

    And I realise I am explaining this all in the worst way possible.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think I might know what your problem is. The For Each XY element will always loop through Depth-0 only. Are you expecting that both "levels" get created at the same time ?

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