Strugling with array…

0 favourites
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • Np glad you sort it out)

  • Just another quick question: When I get my second value, let say that I also want to put a Z dimension in my array (like 2 depth). So I can select a random dimension between 0,1 and 2 with different values for my selected cell. But how can I make the loop stop?

    For now I did something like this but the value change at every tick:

    + System: For "Y" from 0 to Array.Height-1
    ----+ Array: Value at (0, LoopIndex("Y")) = Variable1
    -----> Text: Set text to Array.At(1,LoopIndex("Y"),Array.CurZ)
    -----> System: Stop loop
    

    So do I have to make another loop for the "Z"?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just another quick question: When I get my second value, let say that I also want to put a Z dimension in my array (like 2 depth). So I can select a random dimension between 0,1 and 2 with different values for my selected cell. But how can I make the loop stop?

    For now I did something like this but the value change at every tick:

    + System: For "Y" from 0 to Array.Height-1

    ----+ Array: Value at (0, LoopIndex("Y")) = Variable1

    -----> Text: Set text to Array.At(1,LoopIndex("Y"),Array.CurZ)

    -----> System: Stop loop

    So do I have to make another loop for the "Z"?

    System: For "Y" from 0 to Array.Height-1
    Array: Value at (0, LoopIndex("Y")) = Variable1
    -----> Text: Set text to Array.At(1,LoopIndex("Y"),random(Array.Depth))
    -----> System: Stop loop
    

    For now I did something like this but the value change at every tick:

    I mentioned that on my last comment:

    4-If you dont need to check the Array every tick make sure you put this code under a trigger or a function so you can call it only once, as how it is now is running every tick.

    I highly recommend you first read how the events work before you carry on or you will have many issues like that, which will make you spend hours debugging or changing Events unnecessarily.

    Read this part of the Manual as many times as you need until you understood everything properly.

    https://www.construct.net/en/make-games/manuals/construct-3/project-primitives/events/how-events-work

    You will find important info to avoid issues like "Running events every tick".

  • Thank you again tarek2

    I highly recommend you first read how the events work before you carry on or you will have many issues like that, which will make you spend hours debugging or changing Events unnecessarily.

    In fact I did know how it works and I usually test my event with the keyboard key press trigger. I don't know what I did and why it doesn't worked well last night, I was probably too tired to use my brain correctly!

    Anyway, thanks again for your help!

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