Function dont work in loop

0 favourites
  • 3 posts
From the Asset Store
_______ Huge collection of metal fixtures ________
  • Role:

    The mapLayer array and tileSets dictionary are feeded when some json files is loaded with AJAX synchronously, but i am controlling this using a variable called loadingMapCycle. After AJAX load all the files, the variable loadingMapCycle will be changed to 1.

    When i try to use getTileMapByTileId function in the mapLayer array loop, it will be called once.

    The code with commented function:

    And the output in console log is:

    mapLayer qtt 4

    tileMapLayer groundLevel

    tileMapLayer belowLevel

    tileMapLayer sameLevel

    tileMapLayer topLevel

    When i active the followed selected line, it will print in the loop only one time

    the log:

    mapLayer qtt 4

    tileMapLayer groundLevel

    This is my function:

    What should i need to do to this functions work in this loop?

    Tagged:

  • The "stop loop" action doesn't work for loops like "Dictionary For Each Key" or "Array for each XYZ". It only works for System loops.

    What it does in your case is actually stopping the parent loop - "System for each MapLayer".

    See this post:

    github.com/Scirra/Construct-bugs/issues/4823

    If you want to stop the "Tilesets For each key" loop, use a variable.

    TileSets For each key
    Compare varStopLoop=0
    
    .. TileSets current value<mapTileid : Set varStopLoop to 1
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The "stop loop" action doesn't work for loops like "Dictionary For Each Key" or "Array for each XYZ". It only works for System loops.

    What it does in your case is actually stopping the parent loop - "System for each MapLayer".

    See this post:

    https://github.com/Scirra/Construct-bugs/issues/4823

    If you want to stop the "Tilesets For each key" loop, use a variable.

    > TileSets For each key
    Compare varStopLoop=0
    
    .. TileSets current value<mapTileid : Set varStopLoop to 1
    

    Thank you man.

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