[Solver] Not understanding this loop issue

0 favourites
  • 3 posts
From the Asset Store
For Adventure, Action, Heroes, Sci-fi and Action-RPG games.
  • So in this function I have 2 loops, one called "item" and one called "z".

    "item" loops through the X index of an array called "Chance", while "z" loops through the depth of the array (which is 2).

    "item" returns me the X position at which this function stops, while "z" returns the depth at what that happens

    But for some reason, "z" always returns 0, when the events are like this:

    (in this order, the loop goes "1,0" "1,1" "2,0" "2,1" "3,0" "3,1"... and always stops at "X, 0" for some reason)

    (events 21 and 23)

    [attachment=1:1bqx9n76][/attachment:1bqx9n76]

    And if I switch the order of the loops, "z" always returns 1

    (in this order, the loop goes "1,0" "2,0" "3,0" "4,0" "5,0" "6,0"... and always stops at "X, 1" for some reason)

    (events 21 and 23)

    [attachment=0:1bqx9n76][/attachment:1bqx9n76]

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • One obvious problem is that you check endloop=1 to Stop the outer loop, but the inner one will still run one more time. You should at least have an Else after Endloop=1 to stop that inner loop.

  • One obvious problem is that you check endloop=1 to Stop the outer loop, but the inner one will still run one more time. You should at least have an Else after Endloop=1 to stop that inner loop.

    Oh my god, I love you @

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