Can Anyone Confirm if this is a Bug (Function & While)

  • Can anyone confirm if this is a bug I been looking at it for many hours and I can't see why is not working, I'm pretty sure is me that I miss something or I have done something because is working the same in C2/C3

    1-They are 12 Sprites where each one of them should ad 1 to Global Variable "Calls" and call the Function "A"

    2-On Function "A" >>> while Variable ("Index" < 5) we add 1 to Index Else we stop the Loop and change the Frame

    Problem:

    Only one Sprite keeps calling the Function as you can see by the "calls" where it ads one by one instead of 12 by 12

    Plus you can see the Frame only changes in one sprite

    Theory

    It looks like the problem is on (Event 5) with the Action (Stop Loop) because when I remove it everything starts to work normally perhaps the stop the Loop stops the (Loop on Event 1) or perhaps it's me that I'm going crazy and I forgot something Basic Jeje

    Thank you

    https://www.dropbox.com/s/wq42rp2m32hxe4p/0-Function%20%26%20While%20Bug.capx?dl=0

  • Your 'Stop loop' is not in the while-loop. You call it after the while-loop with the else and then it breaks the for each-loop, because that is where its in.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Your 'Stop loop' is not in the while-loop. You call it after the while-loop with the else and then it breaks the for each-loop, because that is where its in.

    Haah Thank you Asmodean indeed that was the problem, sorry for the late Reply

    Honestly I don't use the "while" Loop very often well I try not to use it at all and for some reason I thought that the Else it will apply only to the "While Loop" on that scop as it was inside a Function I didn't think it will affect any other Loop outside the Function, I'm glad I check this out before I keep using it that way without knowing it and do a big mess.

    Thanks for your help mate.

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