How do I use while corrcetly?

0 favourites
  • 8 posts
  • My while loop never ends so i am clearly doing something wrong, but i do not understand what. It doesnt even end when i call the system expression stop loop. it only stops when i enable the disabled event you can see at the top. Does while not execute subfunctions? How do i do this correctly? :)

    The loop must be executet in this tick, as it is a levelgenerator.

    Kind regards

    J0schi

    Edit: i got a request time out while uploading the picture so here is a link :)

    gyazo.com/c3385ad83a455a4d0a5e28f1da398ebc

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Post your while conditions here

  • Jea sorry, i thought i posted them but somehow the picture did not get uploaded :D

    gyazo.com/c3385ad83a455a4d0a5e28f1da398ebc

    Kind regards

  • When you compare: System -> walkerdirektion = 2,3,4

    Add an else above it, like:

    If 1 -> Do

    else If 2 -> Do

    else If 3 -> Do

    else If 4 -> Do

  • Thanks, but where do i put the while loop then? I had it with else but it did not work, so i changed it to how it looks now... The thing is i cant use if, because the direction is set in an event before, and it could be that the walker is on the top left corner, so he has to change directions till he is not going to the left and not going to the right... I just dont get it how this can be an infinite loop, maybe i am doing something in the wrong order?

    Kind regards

  • Thanks, but where do i put the while loop then? I had it with else but it did not work, so i changed it to how it looks now... The thing is i cant use if, because the direction is set in an event before, and it could be that the walker is on the top left corner, so he has to change directions till he is not going to the left and not going to the right... I just dont get it how this can be an infinite loop, maybe i am doing something in the wrong order?

    Kind regards

    Can you send me the project? I will try to debug

  • I sent you a message on discord.

  • klabundee figgured it out! Thanks for your help. Problem was, that at the start of the layout "walkerdirection" was 0 so none of the conditions where true at the beginning, so the while could not finish :D

    Thanks again!

    J0schi

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