Array problem

This forum is currently in read-only mode.
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • I apologize if this question has been asked before.

    I am having trouble with the array object. I put values in (X,X,1) for a 2D array, but when I debug all I'm getting are the values for the first set of numbers like its a 1 dimensional array (X,1,1). I don't understand why.

  • The debugger will only display a 1d array regardless if your array is 2d or 3d.

  • That makes the debugger kind of useless for arrays doesn't it?

    Is there other way I can check the values in those positions that wont show up?

  • I'm trying to build a grid system in code (invisible grid) and thought an array would be the best option.

    I wanted the array grid to change values (0 = false, 1 = true) if an object was covering those corresponding potions on the game field.

    I tried a few variations of:

    Start of Layout

    ->Set Array size to X=layoutWidth/gridsize Y=layoutHeight/gridsize

    Fox "x" from 0 to layoutWidth/gridsize

    Fox "y" from 0 to layoutHeight/gridsize

    --If object is over gridsize*loopindex("x"),gridsize*loopindex("y")

    ->Set Array Index (loopindex("x"),loopindex("x")) to 1


    ->Set Array Index (loopindex("x"),loopindex("x")) to 0

    But the array just wont recognize if something has been placed over the corresponding coordinates.

    Can I not use the array this way?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • its a lot easy're to use the (for each element)condition than dealing with custom loops if your checking everything in an array.

    further more, just convert the point your checking to a point in the array


    set value: x to round(.x / 128) set value: y to round(.y / 128)or whatever your tile sizes are.

    and just work with those values, Its just a lot easier to deal with.

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